-
Notifications
You must be signed in to change notification settings - Fork 0
ci: publish Dart packages with OIDC #4
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
5 commits
Select commit
Hold shift + click to select a range
9833ade
style: apply Dart formatter
Fermionic-Lyu b030bbd
ci: publish Dart packages with OIDC
Fermionic-Lyu 04ca2e2
ci: create stable Dart releases
Fermionic-Lyu b9a7ae5
ci: harden pub.dev publishing
Fermionic-Lyu 9e9917f
ci: gate and align Flutter releases
Fermionic-Lyu 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: github-actions | ||
| directory: / | ||
| schedule: | ||
| interval: weekly |
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,92 @@ | ||
| name: Publish insforge_flutter to pub.dev | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "insforge_flutter-v[0-9]+.[0-9]+.[0-9]+" | ||
| - "insforge_flutter-v[0-9]+.[0-9]+.[0-9]+-*" | ||
| - 'insforge_flutter-v[0-9]+.[0-9]+.[0-9]+\+*' | ||
|
|
||
| jobs: | ||
| validate: | ||
| name: Validate release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| stable: ${{ steps.version.outputs.stable }} | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | ||
|
|
||
| - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 | ||
|
|
||
| - name: Validate tag matches package version | ||
| id: version | ||
| env: | ||
| RELEASE_TAG: ${{ github.ref_name }} | ||
| run: | | ||
| version="$(sed -n 's/^version:[[:space:]]*//p' packages/insforge_flutter/pubspec.yaml)" | ||
| if [ "$RELEASE_TAG" != "insforge_flutter-v$version" ]; then | ||
| echo "Tag $RELEASE_TAG does not match insforge_flutter version $version." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "version=$version" >> "$GITHUB_OUTPUT" | ||
| if [[ "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then | ||
| echo "stable=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "stable=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Check lockstep versions | ||
| # Run the dependency-free script directly so Dart does not try to | ||
| # resolve the root workspace, which also contains a Flutter package. | ||
| run: dart tool/set_version.dart --check | ||
|
|
||
| - name: Verify matching insforge version is published | ||
| env: | ||
| RELEASE_VERSION: ${{ steps.version.outputs.version }} | ||
| run: | | ||
| if ! curl --fail --silent --show-error --retry 5 --retry-delay 10 \ | ||
| "https://pub.dev/api/packages/insforge/versions/$RELEASE_VERSION" \ | ||
| >/dev/null; then | ||
| echo "insforge $RELEASE_VERSION is not available on pub.dev yet." >&2 | ||
| echo "Publish insforge-v$RELEASE_VERSION first and wait for it to become available." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| quality: | ||
| name: Run release quality checks | ||
| permissions: | ||
| contents: read | ||
| uses: ./.github/workflows/ci.yaml | ||
|
|
||
| publish: | ||
| name: Publish insforge_flutter | ||
| needs: [validate, quality] | ||
| permissions: | ||
| id-token: write | ||
| uses: dart-lang/setup-dart/.github/workflows/publish.yml@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 | ||
| with: | ||
| working-directory: packages/insforge_flutter | ||
|
|
||
| release: | ||
| name: Create stable GitHub Release | ||
| if: needs.validate.outputs.stable == 'true' | ||
| needs: [validate, publish] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Create GitHub Release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_TAG: ${{ github.ref_name }} | ||
| REPOSITORY: ${{ github.repository }} | ||
| run: | | ||
| if gh release view "$RELEASE_TAG" --repo "$REPOSITORY" >/dev/null 2>&1; then | ||
| echo "GitHub Release $RELEASE_TAG already exists" | ||
| else | ||
| gh release create "$RELEASE_TAG" --repo "$REPOSITORY" --generate-notes --verify-tag | ||
| fi | ||
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,79 @@ | ||
| name: Publish insforge to pub.dev | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "insforge-v[0-9]+.[0-9]+.[0-9]+" | ||
| - "insforge-v[0-9]+.[0-9]+.[0-9]+-*" | ||
| - 'insforge-v[0-9]+.[0-9]+.[0-9]+\+*' | ||
|
|
||
| jobs: | ||
| validate: | ||
| name: Validate release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| stable: ${{ steps.version.outputs.stable }} | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | ||
|
|
||
| - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 | ||
|
|
||
| - name: Validate tag matches package version | ||
| id: version | ||
| env: | ||
| RELEASE_TAG: ${{ github.ref_name }} | ||
| run: | | ||
| version="$(sed -n 's/^version:[[:space:]]*//p' packages/insforge/pubspec.yaml)" | ||
| if [ "$RELEASE_TAG" != "insforge-v$version" ]; then | ||
| echo "Tag $RELEASE_TAG does not match insforge version $version." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then | ||
| echo "stable=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "stable=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Check lockstep versions | ||
| # Run the dependency-free script directly so Dart does not try to | ||
| # resolve the root workspace, which also contains a Flutter package. | ||
| run: dart tool/set_version.dart --check | ||
|
|
||
| quality: | ||
| name: Run release quality checks | ||
| permissions: | ||
| contents: read | ||
| uses: ./.github/workflows/ci.yaml | ||
|
|
||
| publish: | ||
| name: Publish insforge | ||
| needs: [validate, quality] | ||
| permissions: | ||
| id-token: write | ||
| uses: dart-lang/setup-dart/.github/workflows/publish.yml@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 | ||
| with: | ||
| working-directory: packages/insforge | ||
|
|
||
| release: | ||
| name: Create stable GitHub Release | ||
| if: needs.validate.outputs.stable == 'true' | ||
| needs: [validate, publish] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Create GitHub Release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_TAG: ${{ github.ref_name }} | ||
| REPOSITORY: ${{ github.repository }} | ||
| run: | | ||
| if gh release view "$RELEASE_TAG" --repo "$REPOSITORY" >/dev/null 2>&1; then | ||
| echo "GitHub Release $RELEASE_TAG already exists" | ||
| else | ||
| gh release create "$RELEASE_TAG" --repo "$REPOSITORY" --generate-notes --verify-tag | ||
| fi |
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
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 |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| # Files excluded from the published package archive (not from git). | ||
| # Tests aren't needed by consumers and keep the package small. | ||
| # Local tooling, build artifacts, and tests aren't needed by consumers. | ||
| .dart_tool/ | ||
| build/ | ||
| test/ |
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
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.