Merge pull request #139 from navidys/pakcit_multiarch_build #46
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 | |
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.18" | |
- name: Build binary | |
run: | | |
make binary-remote | |
- 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 "develop" | |
else | |
echo "v${VERSION} latest" | |
fi | |
- name: Build container image | |
uses: redhat-actions/buildah-build@v2 | |
id: build_image | |
with: | |
image: ${{ env.IMAGE_NAMESPACE }} | |
tags: "${{ steps.image_tag.outputs.IMAGE_TAG }}" | |
containerfiles: | | |
./Containerfile | |
- name: Publish container image | |
id: push_to_quay | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build_image.outputs.image }} | |
tags: ${{ steps.build_image.outputs.tags }} | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Print image url | |
run: echo "Image pushed to ${{ steps.push_to_quay.outputs.registry-paths }}" |