From fbf4489bb881870cadab01f3fc0b935672d10b17 Mon Sep 17 00:00:00 2001 From: nanos Date: Thu, 15 Aug 2024 09:38:54 +0100 Subject: [PATCH] Add a new workflow that will automatically update the VERSION string on tagged releases --- .github/workflows/build-container.yaml | 13 ++++++---- .github/workflows/update-version-number.yaml | 27 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/update-version-number.yaml diff --git a/.github/workflows/build-container.yaml b/.github/workflows/build-container.yaml index ac6cb42..37f4dfd 100644 --- a/.github/workflows/build-container.yaml +++ b/.github/workflows/build-container.yaml @@ -1,15 +1,17 @@ name: Build Container -"on": - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" +on: + workflow_run: + workflows: [Update Version number] + types: + - completed jobs: docker: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -24,6 +26,7 @@ jobs: id: docker_build uses: docker/build-push-action@v5 with: + context: . push: true platforms: linux/amd64,linux/arm64 tags: | diff --git a/.github/workflows/update-version-number.yaml b/.github/workflows/update-version-number.yaml new file mode 100644 index 0000000..5bba925 --- /dev/null +++ b/.github/workflows/update-version-number.yaml @@ -0,0 +1,27 @@ +name: Update Version number + +"on": + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout original repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Git + run: | + git config user.name nanos-bot + git config user.email bot@thms.uk + - name: Update version number + run: | + VERSION=${{ github.ref_name }} + VERSION="${VERSION:1}" + sed -i '' -E 's/VERSION = "[0-9]+.[0-9]+.[0-9]+"/VERSION = "'$VERSION'"/' find_posts.py + git add find_posts.py + git commit -m "[bot] Bump version to $VERSION" + - name: Push to repository + run: git push --quiet