Release #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
env: | |
IMAGE_NAME: activemq-artemis-operator | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install prerequisites | |
run: > | |
sudo apt-get update && | |
sudo apt-get install pass | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.20.13' | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Create release tag | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
git fetch --tags --force | |
HEAD_COMMIT="$(git rev-parse HEAD)" | |
RELEASE_TAG="$(grep -m 1 -oP '(?<=Version = ")[^"]+' version/version.go)" | |
RELEASE_TAG_COMMIT="$(git rev-list -n 1 ${RELEASE_TAG} || true)" | |
if [ "$RELEASE_TAG_COMMIT" != "$HEAD_COMMIT" ]; then | |
git config user.name 'artemiscloud-bot' | |
git config user.email '[email protected]' | |
git tag -a ${RELEASE_TAG} -m ${RELEASE_TAG} --force | |
git push origin $RELEASE_TAG --force | |
fi | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Check doc.crds.dev | |
run: for i in {1..30}; do curl "https://doc.crds.dev/github.com/${{ github.repository }}@${{ github.ref_name }}" | grep 'ActiveMQArtemis' && break; sleep 1; done | |
- name: Checkout artemiscloud.github.io | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.repository_owner }}/artemiscloud.github.io | |
path: artemiscloud.github.io | |
token: ${{ secrets.BOT_TOKEN }} | |
- name: Build the docs | |
run: > | |
rm -rf artemiscloud.github.io/content/en/docs && | |
cp -r docs artemiscloud.github.io/content/en && | |
cd artemiscloud.github.io && | |
npm install && npm run build | |
- name: Push the docs | |
run: > | |
cd artemiscloud.github.io && | |
git config user.name 'ArtemisCloud Bot' && | |
git config user.email '[email protected]' && | |
git add --all && git commit --all --allow-empty --message 'Update docs to ${{ github.ref_name }}' && git push | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Build the image | |
run: | | |
podman build --build-arg TARGETOS=linux --build-arg TARGETARCH=amd64 --no-cache --platform linux/amd64 --manifest $IMAGE_NAME:latest . | |
podman build --build-arg TARGETOS=linux --build-arg TARGETARCH=arm64 --no-cache --platform linux/arm64 --manifest $IMAGE_NAME:latest . | |
- name: Push the image | |
run: | | |
IMAGE_TAG="$(git describe --exact-match --tags | sed 's/v//')" | |
podman login --username=${{ secrets.QUAY_USERNAME }} --password=${{ secrets.QUAY_PASSWORD }} quay.io | |
podman manifest push $IMAGE_NAME:latest docker://quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME:latest | |
podman manifest push $IMAGE_NAME:latest docker://quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME:$IMAGE_TAG | |
- name: Build the bundle image | |
run: export BUNDLE_IMG=$IMAGE_NAME-bundle:latest && make bundle-build | |
- name: Push the bundle image | |
run: > | |
RELEASE_TAG="$(git describe --exact-match --tags)" && IMAGE_TAG=${RELEASE_TAG#v} && | |
docker login --username=${{ secrets.QUAY_USERNAME }} --password=${{ secrets.QUAY_PASSWORD }} quay.io && | |
docker tag $IMAGE_NAME-bundle:latest quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME-bundle:$IMAGE_TAG && | |
docker push quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME-bundle:$IMAGE_TAG && | |
docker tag $IMAGE_NAME-bundle:latest quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME-bundle:latest && | |
docker push quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME-bundle:latest | |
- name: Create GitHub release | |
run: | | |
RELEASE_TAG="$(git describe --exact-match --tags)" | |
RELEASE_ID=$(curl -v -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/${{ github.repository }}/releases/tags/${RELEASE_TAG}" | jq -r '.id') | |
if [ -n "$RELEASE_ID" ]; then | |
curl -v -L -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}" | |
fi | |
RELEASE_ID=$(curl -v -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/${{ github.repository }}/releases" \ | |
-d "$(jq -c -n --arg tag_name "${RELEASE_TAG}" '{"tag_name":$tag_name,"generate_release_notes":true}')" | jq -r '.id') | |
RELEASE_PACKAGE="activemq-artemis-operator-${RELEASE_TAG}" | |
INSTALL_YAML="activemq-artemis-operator.yaml" | |
rm -rf /tmp/${RELEASE_PACKAGE} | |
mkdir -p /tmp/${RELEASE_PACKAGE} | |
cp -r deploy/* /tmp/${RELEASE_PACKAGE} | |
cp -r config/crs /tmp/${RELEASE_PACKAGE} | |
cp -r examples /tmp/${RELEASE_PACKAGE} | |
cd /tmp/${RELEASE_PACKAGE} | |
zip -r /tmp/${RELEASE_PACKAGE}.zip . | |
curl -v -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" -H "Content-Type: application/octet-stream" \ | |
"https://uploads.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets?name=${RELEASE_PACKAGE}.zip" --data-binary "@/tmp/${RELEASE_PACKAGE}.zip" | |
curl -v -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" -H "Content-Type: text/plain" \ | |
"https://uploads.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets?name=${INSTALL_YAML}" --data-binary "@/tmp/${RELEASE_PACKAGE}/${INSTALL_YAML}" |