-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (50 loc) · 2.37 KB
/
github-actions-runner-detect-release.yaml
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
53
54
name: Get latest release for github actions runner and update if required
on:
schedule:
- cron: '0 * * * *'
jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch release version
id: getrelease
run: |
echo ::set-output name=release_tag::$(curl -sL https://api.github.com/repos/actions/runner/releases/latest | jq '.tag_name' | sed 's/"//g' | sed 's/^v//')
- name: Read internal update version
id: getversion
run: echo "::set-output name=version::$(grep 'ARG RUNNER_VERSION' github-actions-runner/Dockerfile | awk -F'=' '{print $2}')"
- name: Update runner in container
if: steps.getrelease.outputs.release_tag != steps.getversion.outputs.version && steps.getrelease.outputs.release_tag != 'null'
env:
RELEASE_NO: ${{ steps.getrelease.outputs.release_tag }}
CURRENT_VERSION: ${{ steps.getversion.outputs.version }}
run: |
sed -i "s/ARG RUNNER_VERSION=$CURRENT_VERSION/ARG RUNNER_VERSION=$RELEASE_NO/" github-actions-runner/Dockerfile
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
commit-message: Update actions runner to ${{ steps.getrelease.outputs.release_tag }}
title: Update actions runner to ${{ steps.getrelease.outputs.release_tag }}
body: |
Updates [runner][1] to ${{ steps.getrelease.outputs.release_tag }}
Auto-generated by [create-pull-request][2]
[1]: https://github.com/actions/runner
[2]: https://github.com/peter-evans/create-pull-request
labels: dependencies, automated pr
branch: actions-runner-updates
reviewers: pmb59,anilthanki,irisdianauy
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v1
with:
token: ${{ secrets.PAT }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash
- name: Auto approve
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.PAT }}
number: ${{ steps.cpr.outputs.pull-request-number }}