Skip to content

Commit 1107885

Browse files
chore: pub.devへの公開フローを修正
1 parent b895145 commit 1107885

1 file changed

Lines changed: 11 additions & 20 deletions

File tree

.github/workflows/publish.yml

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,28 @@
1-
name: publish-on-tag
1+
# .github/workflows/publish-on-tag.yml
2+
name: Publish to pub.dev (on tag)
23

34
on:
45
push:
56
tags:
6-
- 'v*' # 例: v0.1.1-beta, v0.2.0 など
7+
- 'v*' # pub.dev 側の tag-pattern 'v{{version}}' と揃える
78

89
jobs:
910
publish:
10-
runs-on: ubuntu-latest
11+
# OIDC 認証に必要
12+
permissions:
13+
id-token: write
1114

15+
runs-on: ubuntu-latest
1216
steps:
1317
- uses: actions/checkout@v4
1418

15-
# 安全装置1: タグのコミットが main に含まれているか確認(誤タグ防止)
16-
- name: Ensure tag commit is on main
17-
run: |
18-
git fetch origin main --depth=1
19-
if ! git merge-base --is-ancestor $GITHUB_SHA origin/main; then
20-
echo "::error::This tag is not based on the current main. Aborting."
21-
exit 1
22-
fi
23-
24-
# Dart/Flutter 環境(publishだけなら Dart で十分)
19+
# setup-dart が pub.dev への一時OIDCトークンを用意
2520
- uses: dart-lang/setup-dart@v1
2621

27-
# ドライラン
22+
# 事前検証(dry run)
2823
- name: Dry run
2924
run: dart pub publish --dry-run
3025

31-
# pub.dev の自動公開用の資格情報を OIDC で取得
32-
- name: Setup pub.dev credentials (OIDC)
33-
uses: flutter-actions/setup-pubdev-credentials@v2
34-
35-
# 本公開(Automated publishing 有効時、タグpush起動のワークフローだけが許可される)
26+
# 本公開
3627
- name: Publish
37-
run: dart pub publish -f
28+
run: dart pub publish --force

0 commit comments

Comments
 (0)