From 32b27e1878b2b361e4a558e232c76fad1c943ef6 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 16 Nov 2024 14:31:08 +0100 Subject: [PATCH 1/3] Add .github/workflows/auto_tag_stable.yml This workflow automatically updates and pushes the 'stable' tag when commits are pushed to the branch pointed by https://github.com/OSGeo/PROJ/settings/variables/actions/STABLE_BRANCH --- .github/workflows/auto_tag_stable.yml | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/auto_tag_stable.yml diff --git a/.github/workflows/auto_tag_stable.yml b/.github/workflows/auto_tag_stable.yml new file mode 100644 index 0000000000..9d90fabb3a --- /dev/null +++ b/.github/workflows/auto_tag_stable.yml @@ -0,0 +1,41 @@ +name: Update Stable Tag + +on: + push: + branches: + - '**' # Matches all branches, but we later filter on the one matching the STABLE_BRANCH repository variable + +permissions: + contents: read + +jobs: + update-stable-tag: + runs-on: ubuntu-latest + if: github.repository == 'OSGeo/PROJ' + permissions: + contents: write + steps: + - name: Check branch match + id: check_branch + env: + STABLE_BRANCH: ${{ vars.STABLE_BRANCH }} # Repository variable + run: | + echo "Push detected on branch $GITHUB_REF" + if [[ "${GITHUB_REF#refs/heads/}" != "${STABLE_BRANCH}" ]]; then + echo "This workflow only runs for branch $STABLE_BRANCH. Skipping further steps." + echo "run=false" >> $GITHUB_OUTPUT + else + echo "run=true" >> $GITHUB_OUTPUT + fi + + - name: Checkout code + if: steps.check_branch.outputs.run == 'true' + uses: actions/checkout@v4 + + - name: Tag + if: steps.check_branch.outputs.run == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git tag -f stable + git push -f origin stable From 12fcf290d0ec7b4dab109131a5dcbd51bcc2c6ff Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 18 Nov 2024 11:39:07 +0100 Subject: [PATCH 2/3] auto_tag_stable.yml: try tuning to trigger a RtD build --- .github/workflows/auto_tag_stable.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/auto_tag_stable.yml b/.github/workflows/auto_tag_stable.yml index 9d90fabb3a..8403501796 100644 --- a/.github/workflows/auto_tag_stable.yml +++ b/.github/workflows/auto_tag_stable.yml @@ -37,5 +37,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + touch .dummy-file + git add .dummy-file + # Do that so that stable doesn't have the same git sha as the stable branch, so ReadTheDocs triggers a build + git commit -a -m "Add .dummy-file" git tag -f stable git push -f origin stable From e8856d3ddb92ab215e9321cb5e5f919c51ddc6c1 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 18 Nov 2024 11:49:19 +0100 Subject: [PATCH 3/3] auto_tag_stable.yml: run git config --- .github/workflows/auto_tag_stable.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/auto_tag_stable.yml b/.github/workflows/auto_tag_stable.yml index 8403501796..62081a42d3 100644 --- a/.github/workflows/auto_tag_stable.yml +++ b/.github/workflows/auto_tag_stable.yml @@ -37,6 +37,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + git config --global user.email "PROJ-bot@example.com" + git config --global user.name "PROJ-bot" touch .dummy-file git add .dummy-file # Do that so that stable doesn't have the same git sha as the stable branch, so ReadTheDocs triggers a build