|
| 1 | +name: ci-update-workflow |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run every hour. |
| 6 | + - cron: '0 * * * *' |
| 7 | + |
| 8 | +jobs: |
| 9 | + update-go-versions: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - id: 'auth' |
| 13 | + uses: 'google-github-actions/auth@v1' |
| 14 | + with: |
| 15 | + credentials_json: '${{ secrets.GCP_CREDENTIALS }}' |
| 16 | + |
| 17 | + - name: 'Set up Cloud SDK' |
| 18 | + uses: 'google-github-actions/setup-gcloud@v1' |
| 19 | + with: |
| 20 | + version: '423.0.0' |
| 21 | + |
| 22 | + - name: Get available Go versions |
| 23 | + run: | |
| 24 | + # Get all supported Go versions and pass the space-separated versions |
| 25 | + # string to the next step |
| 26 | + versions=$(gcloud functions runtimes list --format="value(NAME)" --project=test-asm-chizhg --region=us-west1 | grep ^go | tr '\n' ' ' | xargs) |
| 27 | + echo "::set-output name=versions::$versions" |
| 28 | + id: get_versions |
| 29 | + |
| 30 | + - name: Checkout appengine repo |
| 31 | + uses: actions/checkout@v2 |
| 32 | + |
| 33 | + - name: Update Go versions |
| 34 | + run: | |
| 35 | + readarray -d ' ' -t versions <<< "${{ steps.get_versions.outputs.versions }}" |
| 36 | + |
| 37 | + versions_str="" |
| 38 | + for version in "${versions[@]}"; do |
| 39 | + major=${version:2:1} |
| 40 | + minor=${version:3:2} |
| 41 | + versions_str+="'$major.$minor.x', " |
| 42 | + done |
| 43 | + # Remove the last comma and space |
| 44 | + versions_str=${versions_str%, *} |
| 45 | +
|
| 46 | + # Only replace the first occurance |
| 47 | + sed -i "0,/^ go-version: \[.*/s// go-version: \[$versions_str\]/" .github/workflows/ci-v2.yaml |
| 48 | + |
| 49 | + - name: Create Pull Request |
| 50 | + uses: peter-evans/create-pull-request@v4 |
| 51 | + with: |
| 52 | + token: ${{ secrets.PAT }} |
| 53 | + commit-message: Update go-version matrix |
| 54 | + title: Update go-version matrix |
| 55 | + body: | |
| 56 | + - go-version matrix updates |
| 57 | +
|
| 58 | + Update the go-version matrix in the CI workflows to include the new supported runtimes. |
| 59 | + |
| 60 | + Auto-generated by [create-pull-request][1] |
| 61 | + |
| 62 | + [1]: https://github.com/peter-evans/create-pull-request |
| 63 | + branch: update-go-version-matrix |
0 commit comments