From e51207389626db2bf433ef9981cd2cbd79edb4ee Mon Sep 17 00:00:00 2001 From: Arthur Pastel Date: Thu, 22 Feb 2024 18:08:32 +0100 Subject: [PATCH] chore(ci): add a workflow to bump the runner version --- .github/workflows/bump-runner-version.yml | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/bump-runner-version.yml diff --git a/.github/workflows/bump-runner-version.yml b/.github/workflows/bump-runner-version.yml new file mode 100644 index 0000000..0382dc4 --- /dev/null +++ b/.github/workflows/bump-runner-version.yml @@ -0,0 +1,45 @@ +name: Bump the runner version + +on: + workflow_dispatch: + inputs: + version: + description: "Runner version" + required: true + +permissions: + contents: write + pull-requests: write + +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Bump + env: + GH_TOKEN: ${{ github.token }} + run: | + # Check that the version is a valid semver + if ! echo "${{ github.event.inputs.version }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$'; then + echo "Invalid version" + exit 1 + fi + # Check that this release exists in the CodSpeedHQ/runner repository + if ! gh release view v${{ github.event.inputs.version }} -R CodSpeedHQ/runner; then + echo "Release ${{ github.event.inputs.version }} does not exist in CodSpeedHQ/runner" + exit 1 + fi + + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + echo "Bumping runner version to ${{ github.event.inputs.version }}" + BRANCH_NAME=bump-runner-version/${{ github.event.inputs.version }} + git checkout -b $BRANCH_NAME + echo ${{ github.event.inputs.version }} > .codspeed-runner-version + git add .codspeed-runner-version + git commit -m "Bump runner version to ${{ github.event.inputs.version }}" + git push origin $BRANCH_NAME + gh pr create --title "Bump runner version to ${{ github.event.inputs.version }}" --body "Bump runner version to ${{ github.event.inputs.version }}" --base main --head $BRANCH_NAME