Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
nomyfan committed Feb 20, 2024
1 parent 7e8b797 commit cb899cf
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ name: ci

on:
push:
tags:
- "v*.*.*"
branches: [main, ci]
# tags:
# - "v*.*.*"
env:
CARGO_TERM_COLOR: always

jobs:
build-release:
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
strategy:
fail-fast: false
matrix:
Expand All @@ -28,6 +30,19 @@ jobs:
contents: write

steps:
- name: Set release version
shell: pwsh
run: |
$regex = '(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?'
$ok = "${{ github.event.head_commit.message }}" -match $regex
if ($ok) {
$version = "v$Matches[0]"
Write-Host $version
echo "RELEASE_VERSION=$version" >> $env::GITHUB_ENV
} else {
throw 'Semver is not found in commit message.'
}
- name: Checkout
uses: actions/checkout@v4

Expand Down Expand Up @@ -100,4 +115,5 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
tag_name: ${{ env.RELEASE_VERSION }}
files: ${{ env.ARCHIVE_PATH }}

0 comments on commit cb899cf

Please sign in to comment.