-
Notifications
You must be signed in to change notification settings - Fork 8
ci: add network-launcher bump and promote workflows #561
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
4 commits
Select commit
Hold shift + click to select a range
a3e9c1f
ci: add workflow to bump network-launcher version
lwshang 220b178
chore: move network-launcher-version to repo root
lwshang 06f4f4a
ci: add workflow to promote network-launcher on version bump
lwshang d42544f
ci: push as app token and check for existing PR explicitly
lwshang 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,75 @@ | ||
| name: Bump network-launcher | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'icp-cli-network-launcher release version (e.g. v12.0.0-2026-04-16-04-20 or 12.0.0-2026-04-16-04-20)' | ||
| required: true | ||
|
|
||
| jobs: | ||
| bump-network-launcher: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Verify release tag exists | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| VERSION="${{ inputs.version }}" | ||
| TAG="v${VERSION#v}" | ||
| if ! gh release view "$TAG" --repo dfinity/icp-cli-network-launcher >/dev/null 2>&1; then | ||
| echo "::error::Release tag '$TAG' not found in dfinity/icp-cli-network-launcher" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Update network-launcher-version | ||
| id: update | ||
| run: | | ||
| VERSION="${{ inputs.version }}" | ||
| VERSION="${VERSION#v}" | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| printf '%s' "$VERSION" > network-launcher-version | ||
|
|
||
| if git diff --quiet; then | ||
| echo "needs_update=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "needs_update=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Create GitHub App Token | ||
| if: steps.update.outputs.needs_update == 'true' | ||
| uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 | ||
| id: app-token | ||
| with: | ||
| client-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_CLIENT_ID }} | ||
| private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} | ||
|
|
||
| - name: Open pull request | ||
| if: steps.update.outputs.needs_update == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| APP_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| VERSION="${{ steps.update.outputs.version }}" | ||
| BRANCH="chore/bump-network-launcher-${VERSION}" | ||
| TITLE="chore(deps): bump network-launcher to ${VERSION}" | ||
| BODY="Updates \`network-launcher-version\` to \`${VERSION}\`." | ||
|
|
||
| git config user.name "pr-automation-bot-public[bot]" | ||
| git config user.email "pr-automation-bot-public[bot]@users.noreply.github.com" | ||
| git remote set-url origin "https://x-access-token:${APP_TOKEN}@github.com/${{ github.repository }}.git" | ||
| git checkout -b "$BRANCH" | ||
| git add network-launcher-version | ||
| git commit -m "$TITLE" | ||
|
lwshang marked this conversation as resolved.
|
||
| git push origin "$BRANCH" --force | ||
|
|
||
| existing=$(gh pr list --head "$BRANCH" --base main --state open --json number --jq 'length') | ||
| if [[ "$existing" == "0" ]]; then | ||
| gh pr create --title "$TITLE" --body "$BODY" --base main --head "$BRANCH" | ||
| else | ||
| echo "PR already open on $BRANCH, branch updated." | ||
| 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,40 @@ | ||
| name: Promote network-launcher | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - network-launcher-version | ||
|
|
||
| jobs: | ||
| promote-network-launcher: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Read version | ||
| id: ver | ||
| run: | | ||
| VERSION=$(tr -d '[:space:]' < network-launcher-version) | ||
| if [[ -z "$VERSION" ]]; then | ||
| echo "::error::network-launcher-version is empty" | ||
| exit 1 | ||
| fi | ||
| echo "tag=v${VERSION#v}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Create GitHub App Token | ||
| uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 | ||
| id: app-token | ||
| with: | ||
| client-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_CLIENT_ID }} | ||
| private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} | ||
| owner: dfinity | ||
| repositories: icp-cli-network-launcher | ||
|
|
||
| - name: Dispatch promote-release workflow | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| gh workflow run promote-release.yml \ | ||
| --repo dfinity/icp-cli-network-launcher \ | ||
| -f tag="${{ steps.ver.outputs.tag }}" |
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
File renamed without changes.
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.