Release #49
Workflow file for this run
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: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install prerequisites | |
run: sudo apt-get install pass | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
- name: Create release tag | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
git fetch --tags --force | |
HEAD_COMMIT="$(git rev-parse HEAD)" | |
RELEASE_TAG="v$(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 'bot@artemiscloud.io' | |
git tag -a ${RELEASE_TAG} -m ${RELEASE_TAG} --force | |
git push origin $RELEASE_TAG --force | |
fi | |
- 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}" | |
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" | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
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@v3 | |
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 'artemiscloudbot@users.noreply.github.com' && | |
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@v1 | |
- 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 |