generated from DeerHide/template_container_image
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.61 KB
/
update-runner.yaml
File metadata and controls
52 lines (45 loc) · 1.61 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
name: Update Runner Version
on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
update-runner:
name: Check and update runner version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_PAT }}
- name: Get latest runner version
id: latest
run: |
VERSION=$(gh api repos/actions/runner/releases/latest --jq '.tag_name' | sed 's/^v//')
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get current runner version
id: current
run: |
VERSION=$(grep -oP 'RUNNER_VERSION=\K\S+' manifest.yaml | head -1)
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Update version files
if: steps.latest.outputs.version != steps.current.outputs.version
env:
CURRENT: ${{ steps.current.outputs.version }}
LATEST: ${{ steps.latest.outputs.version }}
run: |
sed -i "s/RUNNER_VERSION=${CURRENT}/RUNNER_VERSION=${LATEST}/g" \
Containerfile manifest.yaml
- name: Commit and push
if: steps.latest.outputs.version != steps.current.outputs.version
env:
LATEST: ${{ steps.latest.outputs.version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Containerfile manifest.yaml
git commit -m "fix(deps): update github actions runner to ${LATEST}"
git push