summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorCheng Fang <cfang@redhat.com>2024-06-12 15:39:09 -0400
committerGitHub <noreply@github.com>2024-06-12 15:39:09 -0400
commit2a065fad543c5bdac22b13869401d1b47eac0972 (patch)
treef96c76d74af00d43a5ba46f9b658755e49cf889d /.github
parent5fcd41d22e2f5d40775cc5fe893701333d12fd3c (diff)
create github actions workflow init-release.yaml for preparing release (#740)
Signed-off-by: Cheng Fang <cfang@redhat.com>
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/init-release.yaml119
1 files changed, 119 insertions, 0 deletions
diff --git a/.github/workflows/init-release.yaml b/.github/workflows/init-release.yaml
new file mode 100644
index 0000000..44dfa91
--- /dev/null
+++ b/.github/workflows/init-release.yaml
@@ -0,0 +1,119 @@
+name: Init Argo CD Image Updater Release
+on:
+ workflow_dispatch:
+ inputs:
+ TARGET_BRANCH:
+ description: 'TARGET_BRANCH to checkout (e.g. release-0.14)'
+ required: true
+ type: string
+
+ TARGET_VERSION:
+ description: 'TARGET_VERSION to build manifests (e.g. 0.14.0-rc1) Note: the `v` prefix is not used'
+ required: true
+ type: string
+
+permissions: {}
+
+env:
+ TARGET_REMOTE: upstream
+ TARGET_TAG: "v${{ inputs.TARGET_VERSION }}"
+
+jobs:
+ prepare-release:
+ permissions:
+ contents: write # for peter-evans/create-pull-request to create branch
+ pull-requests: write # for peter-evans/create-pull-request to create a PR
+ name: Automatically generate version and manifests on ${{ inputs.TARGET_BRANCH }}
+ runs-on: ubuntu-22.04
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
+ with:
+ fetch-depth: 0
+ fetch-tags: true
+ token: ${{ secrets.GITHUB_TOKEN }}
+ ref: ${{ inputs.TARGET_BRANCH }}
+
+ - name: Check if TARGET_VERSION is well formed.
+ run: |
+ set -ue
+ # Target version must not contain 'v' prefix
+ if echo "${{ inputs.TARGET_VERSION }}" | grep -e '^v'; then
+ echo "::error::Target version '${{ inputs.TARGET_VERSION }}' should not begin with a 'v' prefix, refusing to continue." >&2
+ exit 1
+ fi
+ if ! echo "${{ inputs.TARGET_VERSION }}" | egrep -q '^[0-9]+\.[0-9]+\.[0-9]+$'; then
+ echo "Error: Target version '${{ inputs.TARGET_VERSION }}' is not well-formed. Must be X.Y.Z" >&2
+ exit 1
+ fi
+
+ - name: Checking for current git branch
+ run: |
+ set -ue
+ RELEASE_BRANCH=$(git rev-parse --abbrev-ref HEAD || true)
+ if [[ $RELEASE_BRANCH = release-* ]]; then
+ echo "*** branch is $RELEASE_BRANCH"
+ else
+ echo "Error: Branch $RELEASE_BRANCH is not release branch" >&2
+ exit 1
+ fi
+
+ - name: Checking for existence of git tag
+ run: |
+ set -ue
+ if git show-ref --tags "${{ env.TARGET_TAG }}" --quiet; then
+ echo "Error: Tag with version ${{ env.TARGET_TAG }} already exists." >&2
+ exit 1
+ fi
+
+ - name: Create VERSION information
+ run: |
+ set -ue
+ if ! test -f VERSION; then
+ echo "Error: You should be in repository root." >&2
+ exit 1
+ fi
+ echo "Bumping version from $(cat VERSION) to ${{ inputs.TARGET_VERSION }}"
+ echo "${{ inputs.TARGET_VERSION }}" > VERSION
+
+ - name: Install Kustomize
+ uses: imranismail/setup-kustomize@v2
+ with:
+ kustomize-version: '5.2.1'
+
+ - name: Generate new set of manifests
+ run: |
+ set -ue
+ echo kustomize version $(kustomize version)
+ make manifests IMAGE_TAG="${{ env.TARGET_TAG }}"
+ git diff
+
+ - name: Create pull request
+ id: create-pull-request
+ uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
+ with:
+ commit-message: "Bump version to ${{ inputs.TARGET_VERSION }}"
+ title: "Bump version to ${{ inputs.TARGET_VERSION }} on ${{ inputs.TARGET_BRANCH }} branch"
+ body: Updating VERSION and manifests to ${{ inputs.TARGET_VERSION }}
+ branch: update-version
+ branch-suffix: random
+ signoff: true
+ labels: release
+
+ - name: Next steps
+ run: |
+ echo "Created release PR: ${{ steps.create-pull-request.outputs.pull-request-url }}"
+ echo "Once this PR is merged, pull from ${{ env.TARGET_REMOTE }} ${{ inputs.TARGET_BRANCH }}, tag the release, and build release artifacts."
+ echo "If everything is fine, push changes to GitHub and container registry:"
+ echo " git fetch ${{ env.TARGET_REMOTE }} ${{ inputs.TARGET_BRANCH }}"
+ echo " git switch ${{ inputs.TARGET_BRANCH }}"
+ echo " git pull ${{ env.TARGET_REMOTE }} ${{ inputs.TARGET_BRANCH }}"
+ echo " git tag ${{ env.TARGET_TAG }}"
+ echo " make multiarch-image"
+ echo " make release-binaries"
+ echo " git push ${{ env.TARGET_REMOTE }} ${{ inputs.TARGET_BRANCH }} ${{ env.TARGET_TAG }}"
+ echo " make IMAGE_TAG='${{ env.TARGET_TAG }}' multiarch-image-push"
+ echo
+ echo "Then, create release tag and execute upload-multiarch-release-assets.sh"
+
+