From fad5a47ec2d0715922ba19addec048e121d760e5 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg <2500@gmx.de> Date: Wed, 22 Jan 2025 14:23:08 +0100 Subject: [PATCH 1/2] Update publish workflow --- .github/workflows/{release.yml => publish.yml} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename .github/workflows/{release.yml => publish.yml} (77%) diff --git a/.github/workflows/release.yml b/.github/workflows/publish.yml similarity index 77% rename from .github/workflows/release.yml rename to .github/workflows/publish.yml index 22c7e56a..87dacd44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,5 @@ --- -name: "Release" +name: "Publish Release" on: push: @@ -7,22 +7,22 @@ on: - "v[0-9]+.[0-9]+.[0-9]+" jobs: - release: - runs-on: "ubuntu-20.04" + publish: + runs-on: "ubuntu-latest" if: "github.repository == 'pulp/squeezer'" steps: - uses: "actions/checkout@v4" - name: "Set up Python" uses: "actions/setup-python@v5" with: - python-version: "3.10" + python-version: "3.13" - name: "Install Ansible" run: | pip install --upgrade ansible - name: "Build Ansible Collection" run: | make dist - - name: "Deploy Ansible Collection" + - name: "Publish Ansible Collection" run: | make publish GALAXY_API_KEY=${{ secrets.GALAXY_API_KEY }} ... From 052736224701ff979f272d8f08fb73ce6d8d4b73 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg <2500@gmx.de> Date: Wed, 22 Jan 2025 14:35:18 +0100 Subject: [PATCH 2/2] Add release workflow --- .ci/scripts/release.sh | 25 +++++++++++++++++++++++++ .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100755 .ci/scripts/release.sh create mode 100644 .github/workflows/release.yml diff --git a/.ci/scripts/release.sh b/.ci/scripts/release.sh new file mode 100755 index 00000000..b31163e6 --- /dev/null +++ b/.ci/scripts/release.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -eu -o pipefail + +BRANCH=$(git branch --show-current) + +if ! [[ "${BRANCH}" =~ ^RELEASE-[0-9]+\.[0-9]+$ ]] +then + echo ERROR: This is not a release branch! + exit 1 +fi + +NEW_VERSION="$(bump-my-version show new_version --increment release)" +echo "Release ${NEW_VERSION}" + +if ! [[ "RELEASE-${NEW_VERSION}" == "${BRANCH}"* ]] +then + echo ERROR: Version does not match release branch + exit 1 +fi + +bump-my-version bump release --commit --message "Release {new_version}" --tag --tag-name "v{new_version}" --tag-message "Release {new_version}" +bump-my-version bump patch --commit + +git push origin "${BRANCH}" "v${NEW_VERSION}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..a3637a55 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +--- +name: "Tag Release" + +on: + workflow_dispatch: + +jobs: + release: + name: "Release" + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v4" + with: + token: "${{ secrets.RELEASE_TOKEN }}" + - name: "Set up Python" + uses: "actions/setup-python@v5" + with: + python-version: "3.13" + - name: "Install dependencies" + run: | + python -m pip install --upgrade pip + pip install bump-my-version~=0.29.0 + - name: "Setup git" + run: | + git config user.name pulpbot + git config user.email pulp-infra@redhat.com + - name: "Release" + run: | + .ci/scripts/release.sh +...