Update Cloud CLI version #715
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: Update Cloud CLI version | |
on: | |
schedule: | |
- cron: "10 2 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
id-token: write | |
concurrency: | |
group: "update" | |
cancel-in-progress: true | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
ref: main | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Update Cloud CLI version | |
id: update | |
run: | | |
GCLOUD_CLI_VERSION=$(curl https://okonomi.github.io/google-cloud-cli-release-notes-feed/latest.txt) | |
sed -i -E "s/GCLOUD_CLI_VERSION=.+/GCLOUD_CLI_VERSION=${GCLOUD_CLI_VERSION}/g" Dockerfile | |
echo "version=${GCLOUD_CLI_VERSION}" >> $GITHUB_OUTPUT | |
- name: Push updated | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
if ! git diff --exit-code --quiet | |
then | |
git add . | |
git commit -m "Update Cloud CLI version to ${{ steps.update.outputs.version }}" | |
git tag ${{ steps.update.outputs.version }} | |
git push | |
git push --tags | |
fi |