diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 86179d8e..44bf7de0 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -4,6 +4,12 @@ on: push: tags: - "*" + workflow_call: + inputs: + tag: + required: true + type: string + permissions: contents: read packages: write @@ -15,11 +21,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || github.ref }} - name: Set image name id: image run: | echo "name=${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT" + TAG="${{ inputs.tag || github.ref_name }}" + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" - name: Log in to the Container registry uses: docker/login-action@v3 @@ -38,5 +48,5 @@ jobs: platforms: linux/amd64 push: true tags: | - ${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:${{ github.ref_name }} + ${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:${{ steps.image.outputs.tag }} ${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a4d8664..51413ee5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,3 +44,12 @@ jobs: generate_release_notes: true draft: false prerelease: false + + build: + needs: release + uses: ./.github/workflows/ci-build.yml + with: + tag: ${{ inputs.version }} + permissions: + contents: read + packages: write diff --git a/README.md b/README.md index 9092e078..7fb98b10 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,17 @@ build-desktop.bat ## Release -创建新版本发布: +创建新版本发布有两种方式: + +### GitHub Actions(推荐) + +1. 进入仓库的 [Actions](../../actions) 页面 +2. 选择 "Release" workflow +3. 点击 "Run workflow" +4. 输入版本号(如 `v1.0.0`) +5. 点击 "Run workflow" 执行 + +### 本地脚本 ```bash ./release.sh @@ -103,4 +113,4 @@ build-desktop.bat ./release.sh ghp_xxxx v1.0.0 ``` -脚本会自动创建 tag 并推送到 GitHub,然后创建 Release(自动生成 release notes)。 +两种方式都会自动创建 tag 并生成 release notes。