forked from upa/deadman
-
Notifications
You must be signed in to change notification settings - Fork 0
リリース用アーカイブ生成と GitHub Actions による公開 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "再リリースする既存タグ (例 v0.1.0)" | ||
| required: true | ||
|
|
||
| # 既定はトークンを read のみに絞り、リリースジョブだけ write に昇格する。 | ||
| permissions: | ||
| contents: read | ||
|
|
||
| # 同一タグへの連続 push / 手動再実行で公開ジョブが多重起動し、Release 作成や | ||
| # アセット添付が競合しないよう直列化する (実行中のジョブはキャンセルしない)。 | ||
| concurrency: | ||
| group: release-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Build and publish release archives | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| # GitHub Release の作成・アセット添付に必要 (最小権限)。 | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| # git describe --tags のタグ解決と SOURCE_DATE_EPOCH (git log %ct) の双方に | ||
| # 全履歴・タグが必要。浅いチェックアウトだとバージョンがハッシュへフォール | ||
| # バックし、アーカイブの mtime も不定になる。 | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', github.event.inputs.tag) || github.ref }} | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| # バージョンの単一情報源は go.mod。check-latest で go.mod が指すバージョンを | ||
| # 確実に取得する (ランナー同梱の Go に依存しない)。新しい Go の取り込みは go.mod の更新で行う。 | ||
| go-version-file: go.mod | ||
| check-latest: true | ||
|
|
||
| - name: Run tests | ||
| # 公開前にタグのコミットでテストを通し、壊れたバイナリの出荷を防ぐ。 | ||
| run: make test | ||
|
|
||
| - name: Build cross-platform archives and checksums | ||
| # ビルド・アーカイブ・チェックサムは Makefile が単一の情報源 (CLAUDE.md)。 | ||
| # 同一コミットに複数タグがある場合に git describe が別タグを拾わないよう、 | ||
| # 公開する tag を VERSION として明示的に渡し tag_name と一致させる。 | ||
| run: make package VERSION=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }} | ||
|
|
||
| - name: Publish GitHub Release | ||
| uses: softprops/action-gh-release@v3 | ||
| with: | ||
| tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }} | ||
| # 自動生成ノートはタグ push 時のみ。手動再実行で手書きのリリースノートを上書きしない。 | ||
| generate_release_notes: ${{ github.event_name == 'push' }} | ||
| files: | | ||
| dist/*.tar.gz | ||
| dist/*.zip | ||
| dist/SHA256SUMS | ||
| # GITHUB_TOKEN は自動注入。上の contents:write で fork (yuu61/deadman) へ公開できる。 | ||
| # 注意: fork からの pull_request では token が read-only になり Release 作成に失敗するため、 | ||
| # この workflow に pull_request trigger を足さないこと。 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.