Get latest GitHub Actions Runner #869
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: Get latest GitHub Actions Runner | |
on: | |
schedule: | |
- cron: "40 18 * * *" | |
jobs: | |
update-runner: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set release version and current version | |
id: get-versions | |
run: | | |
echo "current-tag=$(awk -F= '/ACTIONS_VERSION/ {print $2}' docker.env | tr -d '"')" >> $GITHUB_OUTPUT | |
echo "release-tag=$(curl -sL https://api.github.com/repos/actions/runner/releases/latest | jq -r ".tag_name[1:] | tostring")" >> $GITHUB_OUTPUT | |
- name: Compare release and current versions | |
uses: madhead/semver-utils@latest | |
id: compare-versions | |
with: | |
version: ${{ steps.get-versions.outputs.release-tag }} | |
compare-to: ${{ steps.get-versions.outputs.current-tag }} | |
lenient: false # fail on error parsing versions | |
- name: Change release version in docker.env | |
if: ${{ steps.compare-versions.outputs.comparison-result == '>' }} | |
run: sed -i 's|'"${{ steps.get-versions.outputs.current-tag }}"'|'"${{ steps.get-versions.outputs.release-tag }}"'|g' docker.env | |
- name: Create Pull Request | |
if: ${{ steps.compare-versions.outputs.comparison-result == '>' }} | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.SERVICE_ACCOUNT_GITHUB_TOKEN }} | |
commit-message: Update actions runner to new version | |
author: robot-mac-fc <[email protected]> | |
branch: update-actions-runner-to-${{ steps.get-versions.outputs.release-tag }} | |
delete-branch: true | |
title: Update Actions Runner Version to ${{ steps.get-versions.outputs.release-tag }} | |
body: | | |
Automated update from Github Actions Runner version ${{ steps.get-versions.outputs.current-tag }} to version ${{ steps.get-versions.outputs.release-tag }} | |
Release Notes: https://github.com/actions/runner/releases/tag/v${{ steps.get-versions.outputs.release-tag }} | |
team-reviewers: MAC-FC |