-
Notifications
You must be signed in to change notification settings - Fork 9
Add workflow to bump dataplane version #1348
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| # Bump dataplane version | ||
|
|
||
| name: "version-bump.yml" | ||
|
|
||
| # Only run on manual triggers | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| new_version: | ||
| type: "string" | ||
| description: "The new version to set in Cargo.toml (e.g. '0.1.0'). Defaults to bumping the minor version if not provided." | ||
| required: false | ||
| default: "" | ||
|
|
||
| concurrency: | ||
| group: "${{ github.workflow }}:${{ github.ref }}" | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: "write" | ||
| id-token: "write" | ||
| pull-requests: "write" | ||
|
|
||
| jobs: | ||
| bump_version: | ||
| name: "Bump version in Cargo.toml and create Pull Request" | ||
| runs-on: "lab" | ||
| steps: | ||
| - name: "Validate new version input" | ||
| if: ${{ inputs.new_version != '' }} | ||
| run: | | ||
| set -euo pipefail | ||
| new_version="${{ inputs.new_version }}" | ||
| semver_regex='^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$' | ||
| if ! [[ "${new_version}" =~ ${semver_regex} ]]; then | ||
| echo "::error::'new_version' input ('${new_version}') is not a valid SemVer string (e.g. 1.2.3, 1.2.3-alpha.1+build.5)." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: "Install rust" | ||
| uses: "dtolnay/rust-toolchain@stable" | ||
|
|
||
| - name: "Install binstall" | ||
| uses: "cargo-bins/cargo-binstall@main" | ||
|
|
||
| # Use a GitHub App token so that the generated PR can trigger CI | ||
| - name: "Generate GitHub App token" | ||
| id: "app-token" | ||
| uses: "actions/create-github-app-token@v3" | ||
| with: | ||
| app-id: "${{ secrets.DP_APP_ID }}" | ||
| private-key: "${{ secrets.DP_PRIVATE_KEY }}" | ||
|
|
||
| - name: "Install whyq" | ||
| run: | | ||
| set -euxo pipefail | ||
| sudo apt-get update | ||
| sudo apt-get install --yes --no-install-recommends jq | ||
| cargo binstall --no-confirm whyq | ||
|
|
||
| - name: "Install just" | ||
| run: | | ||
| # This keeps our GH actions logs from getting messed up with color codes | ||
| echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list | ||
| sudo apt-get update | ||
| sudo apt-get install --yes --no-install-recommends just | ||
|
|
||
| - name: "Checkout" | ||
| uses: "actions/checkout@v6" | ||
| with: | ||
| persist-credentials: "false" | ||
| fetch-depth: "0" | ||
|
|
||
| - name: "Login to image cache" | ||
| run: | | ||
| echo "${REGISTRY_PASSWORD}" | docker login -u "${REGISTRY_USERNAME}" --password-stdin "${REGISTRY_URL}" | ||
|
|
||
| - name: "Install compile-env" | ||
| run: | | ||
| just --yes dpdp_sys_registry="${REGISTRY_URL}" refresh-compile-env | ||
| just --yes fake-nix | ||
|
|
||
| - name: "Bump version" | ||
| run: | | ||
| if [ -n "${{ inputs.new_version }}" ]; then | ||
| just bump_version "${{ inputs.new_version }}" | ||
|
qmonnet marked this conversation as resolved.
|
||
| else | ||
| just bump_minor_version --input=toml | ||
| fi | ||
| new_version="$(yq -r --input=toml '.workspace.package.version' Cargo.toml)" | ||
| echo "new_version=${new_version}" >> "${GITHUB_ENV}" | ||
|
|
||
| - name: "Commit changes" | ||
| run: | | ||
| if git diff --quiet; then | ||
| echo "No changes to commit" | ||
| exit 0 | ||
| fi | ||
| git config user.name 'github-actions[bot]' | ||
| git config user.email '<41898282+github-actions[bot]@users.noreply.github.com>' | ||
| git commit -sam "bump: Bump dataplane version" | ||
|
|
||
| - name: "Create Pull Request" | ||
| uses: "peter-evans/create-pull-request@v8" | ||
| with: | ||
| token: "${{ steps.app-token.outputs.token }}" | ||
| branch: "bump/bump_dataplane_version" | ||
|
qmonnet marked this conversation as resolved.
|
||
| title: "Bump dataplane version" | ||
| body: | | ||
| Bump dataplane version to ${{ env.new_version }}. | ||
|
|
||
| Triggered by @${{ github.actor }}. | ||
|
|
||
| Do not forget to tag after merging! | ||
| labels: | | ||
| automated | ||
| sign-commits: "true" | ||
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.