ci-update-workflow #604
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
name: ci-update-workflow | |
on: | |
schedule: | |
# Run every day at 10AM. | |
- cron: '0 10 * * *' | |
workflow_dispatch: | |
branches: | |
- master | |
permissions: | |
repository-projects: write | |
pull-requests: write | |
jobs: | |
update-go-versions: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # Enable OIDC | |
steps: | |
- id: 'auth' | |
uses: google-github-actions/auth@3a3c4c57d294ef65efaaee4ff17b22fa88dd3c69 # v1.3.0 | |
with: | |
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | |
- name: 'Set up Cloud SDK' | |
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b # v1.1.1 | |
- 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 "versions=$versions" >> $GITHUB_OUTPUT | |
id: get_versions | |
- name: Checkout appengine repo | |
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 | |
# Sign the commit. | |
# https://www.chainguard.dev/unchained/keyless-git-commit-signing-with-gitsign-and-github-actions | |
- uses: chainguard-dev/actions/setup-gitsign@e74da3cd82dab55e35736f1ef031a12fa5b95299 # 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@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # v4.2.4 | |
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 |