Build and Push Image #60
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 Push Image | |
on: | |
push: | |
paths: | |
- "github-actions-runner/Dockerfile" | |
jobs: | |
build: | |
name: Build and push image | |
runs-on: ubuntu-20.04 | |
env: | |
IMAGE_NAME: github-actions-runner | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Read upstream tag without version | |
id: gettag | |
run: echo "::set-output name=tag::$(head -n 1 github-actions-runner/Dockerfile | awk -F':' '{print $2}' | awk -F'-' 'BEGIN { OFS="-" } {$NF=""; print $0}')" | |
- name: Read internal update version | |
id: getversion | |
run: echo "::set-output name=version::$(grep 'ARG RUNNER_VERSION' github-actions-runner/Dockerfile | awk -F'=' '{print $2}')" | |
- name: Build Image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.IMAGE_NAME }} | |
tags: latest ${{ steps.gettag.outputs.tag }}${{ steps.getversion.outputs.version }} | |
dockerfiles: | | |
./github-actions-runner/Dockerfile | |
- name: Push To Quay | |
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: quay.io/ebigxa | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Use the image | |
run: echo "New image has been pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |