Skip to content

Commit

Permalink
Build and upload container from GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mirekdlugosz committed Jul 3, 2023
1 parent 87438c5 commit 13ebb03
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build Container Image

on:
push:
branches: [ main ]
tags:
- '*'
pull_request:
branches: [main, 'release/*']

env:
STABLE_TAG: ${{ github.event_name == 'push' && github.ref_name || format('pr-{0}', github.event.pull_request.number) }}
# We had a problem with GitHub setting quay expiration label also during
# merge to main, so we just set meaningless value as a workaround.
EXPIRATION_LABEL: ${{ github.event_name == 'push' && 'quipucords.source=github' || 'quay.expires-after=3d' }}

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # fetches all commits/tags

- name: Build qpc image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: quipucords/qpc
tags: ${{ env.STABLE_TAG }} ${{ env.STABLE_TAG == 'main' && 'latest' || '' }}
containerfiles: |
./Dockerfile
labels: |
${{ env.EXPIRATION_LABEL }}
quipucords.cli.git_sha=${{ github.sha }}
- name: Push To quay.io
uses: redhat-actions/push-to-registry@v2
with:
image: quipucords/qpc
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}

0 comments on commit 13ebb03

Please sign in to comment.