Skip to content

Commit

Permalink
Merge branch 'release/0.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
RayWangQvQ committed Mar 20, 2022
2 parents b40472e + 6b2a1bf commit 8d68f80
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 96 deletions.
44 changes: 36 additions & 8 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Publish image

on:
workflow_dispatch:
inputs:
manualTag:
description: 'tag'
required: true
release:
types: [published]

Expand All @@ -25,17 +30,35 @@ jobs:
- name: Check the value
run: |
echo ${{ steps.step_one.outputs.hasToken }}
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_REF#refs/tags/: ${GITHUB_REF#refs/tags/}"
##echo "GITHUB_REF: $GITHUB_REF"
##echo "GITHUB_REF#refs/tags/: ${GITHUB_REF#refs/tags/}"
echo "github.event.release.tag_name: ${{ github.event.release.tag_name }}"
echo "github.event.inputs.manualTag: ${{ github.event.inputs.manualTag }}"
Publish2DockerHub:
runs-on: ubuntu-latest
needs: CheckDockerToken
if: "contains(needs.CheckDockerToken.outputs.hasToken, 'true')"
steps:
-
name: GetRepoTag
id: getRepoTag
run: |
RepoTag=""
if [ "${{ github.event.release.tag_name }}" ] ; then
RepoTag=${{ github.event.release.tag_name }}
fi
if [ "${{ github.event.inputs.manualTag }}" ] ; then
RepoTag=${{ github.event.inputs.manualTag }}
fi
echo "repo tag: $RepoTag"
echo "::set-output name=repoTag::$RepoTag"
-
name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.getRepoTag.outputs.repoTag }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand All @@ -49,17 +72,22 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: GetTagName
id: getTag
name: GetDockerTagNames
id: getDockerTags
run: |
DOCKER_IMAGE_TAG="zai7lou/bilibili_tool_pro:${GITHUB_REF#refs/tags/},zai7lou/bilibili_tool_pro:latest"
echo "docker image tag: $DOCKER_IMAGE_TAG"
echo "::set-output name=tag::$DOCKER_IMAGE_TAG"
DOCKER_IMAGE_TAG="zai7lou/bilibili_tool_pro:${{ steps.getRepoTag.outputs.repoTag }},zai7lou/bilibili_tool_pro:latest"
DOCKER_IMAGE_LATEST_TAG=",zai7lou/bilibili_tool_pro:latest"
if [ "${{ github.event.inputs.manualTag }}" ] ; then
DOCKER_IMAGE_LATEST_TAG=""
fi
DOCKER_IMAGE_TAGS=$DOCKER_IMAGE_TAG$DOCKER_IMAGE_LATEST_TAG
echo "docker image tag: $DOCKER_IMAGE_TAGS"
echo "::set-output name=dockerTags::$DOCKER_IMAGE_TAGS"
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.getTag.outputs.tag }}
tags: ${{ steps.getDockerTags.outputs.dockerTags }}
4 changes: 3 additions & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.version }}

- name: Setup .NET
uses: actions/setup-dotnet@v1
Expand Down Expand Up @@ -51,7 +53,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
release_name: BiliBiliTool-V${{ github.event.inputs.version }}
release_name: BiliBiliToolPro-V${{ github.event.inputs.version }}
draft: true
prerelease: false

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
- 新增`Publish image`workflows,用于发布镜像
- 新增`no-toxic-comments.yml`,用于检测评论
- 更新`auto-close-pr.yml`,用于修正PR的目标到`develop`
## 0.0.6
- 更新docker镜像的构建
-#12】新增配置`Notification:IsSingleAccountSingleNotify`,支持开启每个账号单独推送消息
- publish-release.yml新增手动输入tag功能
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ ENV TIME_ZONE=Asia/Shanghai
COPY --from=publish /app/publish .
COPY ./docker/entry.sh ./docker/crontab /app/
RUN ln -fs /usr/share/zoneinfo/$TIME_ZONE /etc/localtime \
&& echo $TIME_ZONE > /etc/timezone
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak \
&& echo $TIME_ZONE > /etc/timezone \
&& cp /etc/apt/sources.list /etc/apt/sources.list.bak \
&& sed -i 's/deb.debian.org/mirrors.163.com/g' /etc/apt/sources.list \
&& sed -i 's/security.debian.org/mirrors.163.com/g' /etc/apt/sources.list \
&& apt-get clean
RUN apt-get update \
&& apt-get clean \
&& apt-get update \
&& apt-get install -y cron tzdata tofrodos \
&& apt-get clean
RUN fromdos /app/entry.sh \
&& apt-get clean \
&& fromdos /app/entry.sh \
&& chmod +x /app/entry.sh \
&& fromdos /app/crontab
ENTRYPOINT ["/bin/bash", "-c", "/app/entry.sh"]
2 changes: 1 addition & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Authors>Ray</Authors>
<Version>0.0.5</Version>
<Version>0.0.6</Version>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
</PropertyGroup>
</Project>
11 changes: 0 additions & 11 deletions docker/build/buildAndPushImage_multiArch.cmd

This file was deleted.

8 changes: 8 additions & 0 deletions docker/build/buildAndPushImage_multiArch.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
echo "start to build"
# https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/
# https://segmentfault.com/a/1190000021166703
# linux/arm/v6,linux/riscv64,linux/s390x,linux/ppc64le,linux/386,,linux/arm/v7 偶发异常,待进一步测试
echo "Start to build docker image with multi-arch"
# $image="zai7lou/bilibili_tool_pro"
# $version="0.0.5"
docker buildx build --tag "zai7lou/bilibili_tool_pro:0.0.5" --tag "zai7lou/bilibili_tool_pro:latest" --output "type=image,push=true" --platform linux/amd64,linux/arm64 ../..
2 changes: 1 addition & 1 deletion docker/build/buildImage.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
REM start to build
echo Start to build docker image
@echo on
docker build -t zai7lou/bilibili_tool ../..
docker build --tag zai7lou/bilibili_tool_pro:0.0.5 --tag zai7lou/bilibili_tool_pro:latest ../..
@echo off
pause
Loading

0 comments on commit 8d68f80

Please sign in to comment.