-
Notifications
You must be signed in to change notification settings - Fork 16
40 lines (33 loc) · 1.18 KB
/
auto_sdk_update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Update Google Cloud SDK
on:
schedule:
- cron: '0 4 * * 3' # At 04:00 on Wednesday
workflow_dispatch: # or manually
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Get latest version of GCloud SDK
run: |
sudo apt update
sudo apt install snapd
sudo snap install google-cloud-sdk --classic
- name: Set current and latest SDK version variables
run: |
echo "LATEST_GCLOUD_SDK=$(gcloud version | grep "Google Cloud SDK" | sed 's/Google Cloud SDK //')" >> $GITHUB_ENV
echo "CURRENT_GCLOUD_SDK=$(cat google-cloud-sdk/VERSION)" >> $GITHUB_ENV
- name: Update version
if: ${{ env.LATEST_GCLOUD_SDK != env.CURRENT_GCLOUD_SDK }}
run: |
./update.sh $LATEST_GCLOUD_SDK
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ env.LATEST_GCLOUD_SDK != env.CURRENT_GCLOUD_SDK }}
with:
commit_message: Update to ${{ env.LATEST_GCLOUD_SDK }}
branch: master
commit_options: '--no-verify --signoff'
file_pattern: .
skip_dirty_check: true