Skip to content

Release Armada Operator #2

Release Armada Operator

Release Armada Operator #2

Workflow file for this run

name: Release Armada Operator
on:
workflow_run:
types: [completed]
workflows: [CI]
branches:
- v*
permissions:
contents: write
jobs:
validate:
if: github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'armadaproject'
name: "Validate revision"
runs-on: ubuntu-22.04
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
fetch-depth: 0
# The given ref should belong to the main branch.
# If it starts with 'v', it should be a tag, belong to the main branch and match the semver regex.
# Anything else is invalid.
- name: Validate ref
run: |
ref='${{ github.event.workflow_run.head_branch }}'
sha='${{ github.event.workflow_run.head_sha }}'
[[ $ref =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] &&
[ $(git rev-parse refs/tags/$ref) == $sha ] &&
[ $(git branch --contains=$sha main | wc -l) -eq 1 ]
if [ $? -ne 0 ]; then
echo "::error ::Invalid ref $ref $sha: must be a tag, belong to the main branch and match the semver regex"
exit 1
fi
echo "GORELEASER_CURRENT_TAG=$ref" >> $GITHUB_ENV
release:
name: "Release"
runs-on: ubuntu-22.04
environment: armada-dockerhub
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch Git tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: "Docker login"
uses: "docker/login-action@v2"
with:
username: "${{ secrets.DOCKERHUB_USER }}"
password: "${{ secrets.DOCKERHUB_PASS }}"
- name: Set up Syft
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Set GORELEASER_PREVIOUS_TAG # Workaround, GoReleaser uses 'git-describe' to determine a previous tag.
run: echo "GORELEASER_PREVIOUS_TAG=$(git -c 'versionsort.suffix=-rc' tag --list --sort=version:refname | grep -Eo '^v[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$' | tail -n 2 | head -n 1)" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: v1.18.2
args: "-f ./.goreleaser.yaml release --clean"
env:
FULL_RELEASE: true
DOCKER_REPO: "gresearch"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}"
DOCKER_BUILDX_CACHE_FROM: "type=gha"
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max"
- name: Push README to Dockerhub
uses: christian-korneck/update-container-description-action@v1
env:
DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKER_PASS: ${{ secrets.DOCKERHUB_PASS }}
with:
destination_container_repo: gresearch/armada-operator
provider: dockerhub
short_description: 'Armada Operator is the installer for Armada'
readme_file: 'README.md'