gyb-release #75
This file contains hidden or 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: GYB Release | |
on: | |
repository_dispatch: | |
types: [gyb-release] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'GYB Release Tag' | |
jobs: | |
build-and-push: | |
name: Build and push docker image | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Check GYB release info | |
id: release_info | |
run: | | |
gyb_repo="GAM-team/got-your-back" | |
[ -z "${{ github.event.client_payload.tag }}" ] && tag="${{ github.event.inputs.tag }}" || tag="${{ github.event.client_payload.tag }}" | |
[ -z "$tag" ] && { echo "ERROR: No tag passed to workflow'" >&2 && exit 1; } | |
echo "::set-output name=tag::$tag" | |
latest=$(curl -sX GET https://api.github.com/repos/$gyb_repo/releases/latest \ | |
| jq -r '.tag_name') | |
[ "$latest" == "$tag" ] && islatest="true" || islatest="false" | |
echo "::set-output name=islatest::$islatest" | |
rev=$(curl -sX GET "https://api.github.com/repos/$gyb_repo/git/ref/tags/$tag" \ | |
| jq -er '.object.sha') || { echo "ERROR: Could not find a tagged GYB release for '$tag'"; exit 1; } | |
echo "::set-output name=revision::$rev" | |
echo -e "tag: $tag\nrevision: $rev\nisLatest: $islatest" | |
- | |
name: Checkout | |
uses: actions/[email protected] | |
- | |
name: Build a single platform for testing | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
build-args: GYB_VERSION=${{ steps.release_info.outputs.tag }} | |
load: true | |
platforms: linux/amd64 | |
tags: awbn/gyb-test | |
- | |
name: Test | |
uses: plexsystems/[email protected] | |
with: | |
image: awbn/gyb-test:latest | |
config: test/tests.yml | |
#- | |
# name: Login to GHCR | |
# uses: docker/login-action@v3 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.repository_owner }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Container metadata | |
id: metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
awbn/gyb | |
# ghcr.io/awbn/gyb | |
flavor: | | |
latest=${{ steps.release_info.outputs.islatest }} | |
tags: | | |
type=match,pattern=v(.*),group=1,value=${{ steps.release_info.outputs.tag }} | |
labels: | | |
org.opencontainers.image.title=awbn/gyb | |
org.opencontainers.image.documentation=https://github.com/awbn/docker-gyb/blob/main/README.md | |
gyb.source=https://github.com/jay0lee/got-your-back | |
gyb.version=${{ steps.release_info.outputs.tag }} | |
gyb.revision=${{ steps.release_info.outputs.revision }} | |
- | |
name: Set up QEMU for x-platform | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
build-args: GYB_VERSION=${{ steps.release_info.outputs.tag }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: ${{ steps.metadata.outputs.tags }} |