-
Notifications
You must be signed in to change notification settings - Fork 208
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
Add a ci-update-workflow GitHub Actions to update the go-version matrix #307
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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,68 @@ | ||
name: ci-update-workflow | ||
|
||
on: | ||
schedule: | ||
# Run every day at 10AM. | ||
- cron: '0 10 * * *' | ||
|
||
jobs: | ||
update-go-versions: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # Enable OIDC | ||
steps: | ||
- id: 'auth' | ||
uses: 'google-github-actions/auth@v1' | ||
with: | ||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | ||
|
||
- name: 'Set up Cloud SDK' | ||
uses: 'google-github-actions/setup-gcloud@v1' | ||
|
||
- name: Get available Go versions | ||
run: | | ||
# Get all supported Go versions and pass the space-separated versions | ||
# string to the next step | ||
versions=$(gcloud functions runtimes list --format="value(NAME)" --project=gae-runtimes-private --region=us-west1 | grep ^go | tr '\n' ' ' | xargs) | ||
echo "::set-output name=versions::$versions" | ||
id: get_versions | ||
|
||
- name: Checkout appengine repo | ||
uses: actions/checkout@v2 | ||
|
||
# Sign the commit. | ||
# https://www.chainguard.dev/unchained/keyless-git-commit-signing-with-gitsign-and-github-actions | ||
- uses: chainguard-dev/actions/setup-gitsign@main | ||
|
||
- name: Update Go versions | ||
run: | | ||
readarray -d ' ' -t versions <<< "${{ steps.get_versions.outputs.versions }}" | ||
|
||
versions_str="" | ||
for version in "${versions[@]}"; do | ||
major=${version:2:1} | ||
minor=${version:3:2} | ||
versions_str+="'$major.$minor.x', " | ||
done | ||
# Remove the last comma and space | ||
versions_str=${versions_str%, *} | ||
|
||
# Only replace the first occurance | ||
sed -i "0,/^ go-version: \[.*/s// go-version: \[$versions_str\]/" .github/workflows/ci-v2.yaml | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Update go-version matrix | ||
title: Update go-version matrix | ||
body: | | ||
- go-version matrix updates | ||
|
||
Update the go-version matrix in the CI workflows to include the new supported runtimes. | ||
|
||
Auto-generated by [create-pull-request][1] | ||
|
||
[1]: https://github.com/peter-evans/create-pull-request | ||
branch: update-go-version-matrix | ||
reviewers: jinglundong |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to this based on the comment at GoogleCloudPlatform/functions-framework-go#177 (comment)