From 4193c365c1dd8aec9eaf2c23e4da8091bea9c129 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 22:21:13 +0100 Subject: [PATCH 1/5] add workflow to regularly check for a new vroom release --- .github/workflows/check_release.yml | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/check_release.yml diff --git a/.github/workflows/check_release.yml b/.github/workflows/check_release.yml new file mode 100644 index 0000000..cb50c02 --- /dev/null +++ b/.github/workflows/check_release.yml @@ -0,0 +1,55 @@ +name: Check for new VROOM release + +on: + schedule: + - cron: "0 0 * * 0" + workflow_dispatch: + branches: + - nn-gha-check-release + +jobs: + check_tz: + name: Check if VROOM has a new release we don't have yet + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Run script + shell: bash + run: | + set -e + + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + latest_vroom_tag="v1.15.0" #$(curl --silent -L -H "Accept: application/vnd.github+json" https://api.github.com/repos/VROOM-Project/vroom/tags | jq -r '.[0].name') + latest_this_tag=$(git describe --tags --abbrev=0) + + # first check vroom + if [[ $latest_vroom_tag == $latest_this_tag ]]; then + "All up-to-date." + exit 0 + fi + + echo "New Vroom release available: ${latest_vroom_tag}" + new_branch="gha-bump-vroom-${latest_vroom_tag}" + git checkout -b $new_branch + + # update the README + cat README.md | sed -e "s:${latest_this_tag}:${latest_vroom_tag}:g" > README.md + + # commit and push + git commit -m "release ${latest_vroom_tag}" + git push origin "${new_branch}" + + # open new PR + body=$(echo -e "Update CHANGELOG with\n- [vroom](https://github.com/VROOM-Project/vroom/blob/master/CHANGELOG.md)\n- [vroom-express](https://github.com/VROOM-Project/vroom-express/blob/master/CHANGELOG.md)\n\nCreated by workflow run [#${WORKFLOW_RUN_ID}](https://github.com/valhalla/valhalla/actions/runs/${WORKFLOW_RUN_ID}).") + gh pr create --base master --head $new_branch --title "New VROOM release ${latest_vroom_tag}" --body "${body}" + + exit 1 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WORKFLOW_RUN_ID: ${{ github.run_id }} + WORKFLOW_JOB_ID: ${{ github.job }} From f2507ee18e8227d1256fb528827b7e10801c9949 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 22:23:07 +0100 Subject: [PATCH 2/5] oops --- .github/workflows/check_release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_release.yml b/.github/workflows/check_release.yml index cb50c02..affe2f5 100644 --- a/.github/workflows/check_release.yml +++ b/.github/workflows/check_release.yml @@ -4,8 +4,9 @@ on: schedule: - cron: "0 0 * * 0" workflow_dispatch: - branches: - - nn-gha-check-release + push: + branches: + - nn-gha-check-release jobs: check_tz: From afeb24b88ca4274718a9f01e49695c7a9e20c006 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 22:25:19 +0100 Subject: [PATCH 3/5] add with commit --- .github/workflows/check_release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_release.yml b/.github/workflows/check_release.yml index affe2f5..e8129f6 100644 --- a/.github/workflows/check_release.yml +++ b/.github/workflows/check_release.yml @@ -35,14 +35,14 @@ jobs: fi echo "New Vroom release available: ${latest_vroom_tag}" - new_branch="gha-bump-vroom-${latest_vroom_tag}" + new_branch="gha-vroom-release-${latest_vroom_tag}" git checkout -b $new_branch # update the README cat README.md | sed -e "s:${latest_this_tag}:${latest_vroom_tag}:g" > README.md # commit and push - git commit -m "release ${latest_vroom_tag}" + git commit -am "release ${latest_vroom_tag}" git push origin "${new_branch}" # open new PR From a860056c419e0e1ed7f2823aa53d12b27e3a303f Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 22:32:52 +0100 Subject: [PATCH 4/5] sed in-file substitution --- .github/workflows/check_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_release.yml b/.github/workflows/check_release.yml index e8129f6..e01717e 100644 --- a/.github/workflows/check_release.yml +++ b/.github/workflows/check_release.yml @@ -39,7 +39,7 @@ jobs: git checkout -b $new_branch # update the README - cat README.md | sed -e "s:${latest_this_tag}:${latest_vroom_tag}:g" > README.md + sed -i "s/v1.14.0/v1.15.0/g" README.md # commit and push git commit -am "release ${latest_vroom_tag}" From 21be1b5b0c29bb8f4226e4291366c29ffc75c983 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 22:35:03 +0100 Subject: [PATCH 5/5] test succeeded, remove this branch --- .github/workflows/check_release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/check_release.yml b/.github/workflows/check_release.yml index e01717e..0c377ff 100644 --- a/.github/workflows/check_release.yml +++ b/.github/workflows/check_release.yml @@ -4,9 +4,6 @@ on: schedule: - cron: "0 0 * * 0" workflow_dispatch: - push: - branches: - - nn-gha-check-release jobs: check_tz: