Skip to content

Commit

Permalink
ci: support prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Oct 1, 2024
1 parent e00f5f8 commit 191facb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ jobs:
with:
files: assets/*.zip
tag_name: ${{ needs.meta.outputs.tag }}
prerelease: ${{ needs.meta.outputs.is_pre_release }}

- name: Create issue if failed to publish packages
if: steps.nuget.outputs.failed || steps.pip.outputs.failed
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
outputs:
is_release:
value: ${{ jobs.set.outputs.is_release }}
is_pre_release:
value: ${{ jobs.set.outputs.is_pre_release }}
tag:
value: ${{ jobs.set.outputs.tag }}
version:
Expand All @@ -20,6 +22,7 @@ jobs:
- id: set
run: |
is_release=${{ startsWith(github.ref, 'refs/tags/v') }}
is_pre_release=${{ contains(github.ref, '-alpha.') || contains(github.ref, '-beta.') || contains(github.ref, '-rc.') }}
commit_hash=$(git rev-parse --short HEAD)
if $is_release; then
Expand Down Expand Up @@ -50,10 +53,13 @@ jobs:
is_release=$is_release" | tee -a "$GITHUB_OUTPUT"
outputs:
is_release: ${{ steps.set.outputs.is_release }}
is_pre_release: ${{ steps.set.outputs.is_pre_release }}
tag: ${{ steps.set.outputs.tag }} # v<release version> | v<ci version>
version: ${{ steps.set.outputs.version }} # <release version> | <ci version>+<build> e.g ↓
# 主版本号.次版本号.修订号[-(alpha|beta|rc).预发布号]
# [-post.发布后号[-ci.${{ github.run_id }}]+${commit_hash}.${dateY%m%d}]
# 1.7.0
# 1.7.0-beta.1
# 1.7.0-post.6-ci.8678478007+gf5e12a1c.20240413


# 主版本号.次版本号.修订号[-(alpha|beta|rc).预发布号]
# [-post.发布后号[-ci.${{ github.run_id }}]+${commit_hash}.${dateY%m%d}]
# 1.7.0
# 1.7.0-beta.1
# 1.7.0-post.6-ci.8678478007+gf5e12a1c.20240413

0 comments on commit 191facb

Please sign in to comment.