Jak/http callbacks #60
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: Publish Image | |
on: | |
release: | |
types: | |
- published | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
build: | |
env: | |
context: . | |
image_name: swoop-go | |
image_registry: "${{ secrets.REGISTRY_URI }}" | |
image_repository: "${{ secrets.REGISTRY_REPOSITORY }}" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
- name: Get image tags | |
id: image_tags | |
run: | | |
VERSION=$(git describe --tags --abbrev=8 --dirty --always --long) | |
TAGS=("${VERSION}") | |
if [ -n "${{ github.event.release.tag_name }}" ]; then | |
MAJOR="$(<<<"${VERSION}" cut -d '.' -f 1)" | |
MINOR="${MAJOR}.$(<<<"${VERSION}" cut -d '.' -f 2)" | |
TAGS+=('latest' "${MAJOR}" "${MINOR}") | |
fi | |
if [[ "${GITHUB_REF}" =~ refs/tags/(.*) ]]; then | |
TAGS+=("git-${BASH_REMATCH[1]}") | |
fi | |
PREFIX="${{ env.image_registry }}/${{ env.image_repository }}/${{ env.image_name }}" | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "IMAGE_TAGS<<$EOF" >> "$GITHUB_ENV" | |
for tag in "${TAGS[@]}"; do | |
echo "${PREFIX}:${tag}" >> "$GITHUB_ENV" | |
done | |
echo "$EOF" >> "$GITHUB_ENV" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
buildkitd-flags: --debug | |
- name: Login to Quay.io | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.image_registry }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Build and publish image to Quay | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ env.context }} | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name == 'release' }} | |
tags: ${{ env.IMAGE_TAGS }} |