Skip to content

Commit 17d2359

Browse files
authored
Releaseのための準備 (#266)
1 parent 525d2be commit 17d2359

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release packages
2+
on:
3+
push:
4+
tags:
5+
- "[0-9]+.[0-9]+.[0-9]+"
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
validate:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
15+
- name: Validate release version
16+
id: validate
17+
run: |
18+
VERSION="${{ github.ref_name }}"
19+
< ./src/VoicevoxCoreSharp.Core.Unity/package.json | jq -e ".version == \"$VERSION\""
20+
- name: Delete tag on validation failure
21+
if: failure()
22+
run: |
23+
VERSION="${{ github.ref_name }}"
24+
git config user.name "github-actions[bot]"
25+
git config user.email "github-actions[bot]@users.noreply.github.com"
26+
git push --delete origin "$VERSION"
27+
echo "❌ バージョン検証に失敗したため、タグ $VERSION を削除しました"
28+
29+
publish:
30+
needs: validate
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
34+
- uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
35+
with:
36+
dotnet-version: 10
37+
- run: mkdir -p ./artifacts
38+
- run: |
39+
dotnet pack src/VoicevoxCoreSharp.Core/VoicevoxCoreSharp.Core.csproj -p:PackageVersion=${{ github.ref_name }} -c Release -o ./artifacts
40+
# TODO: src/VoicevoxCoreSharp.Experimental/VoicevoxCoreSharp.Experimental.csproj の扱いを考える
41+
- run: dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
42+
- run: gh release create ${{github.ref_name}} --generate-notes ./artifacts/*.nupkg
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)