Merge pull request #318 from containers/dependabot/go_modules/github.… #195
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: Build and Publish | |
on: | |
push: | |
tags: | |
- 'v*' | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-and-publish: | |
name: Publish container image | |
env: | |
IMAGE_REGISTRY: quay.io/navidys | |
IMAGE_NAMESPACE: ${{ github.event.repository.name }} | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '>=1.22' | |
- name: Build binary | |
run: | | |
make binary-remote-amd64 | |
make binary-remote-s390x | |
make binary-remote-ppc64le | |
make binary-remote-arm64 | |
- name: Get image tags | |
id: image_tag | |
run: | | |
echo -n ::set-output name=IMAGE_TAG:: | |
VERSION=$(grep 'VERSION=' VERSION | awk -F= '{print $2'}) | |
REVISION=$(grep 'REVISION=' VERSION | awk -F= '{print $2'}) | |
if [[ "${REVISION}" =~ "dev." ]] ; then | |
echo "${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}:develop" | |
else | |
echo "${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}:v${VERSION},${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}:latest" | |
fi | |
- name: Set up qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Quay.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Build container image | |
uses: docker/build-push-action@v5 | |
id: build_image | |
with: | |
context: . | |
platforms: linux/amd64,linux/s390x,linux/ppc64le,linux/arm64, | |
push: true | |
provenance: false | |
file: "Containerfile" | |
tags: ${{ steps.image_tag.outputs.IMAGE_TAG }} |