Skip to content

Commit

Permalink
chore: build and publish workflow (PROJQUAY-2556)
Browse files Browse the repository at this point in the history
  • Loading branch information
flavianmissi committed Sep 30, 2021
1 parent c4ad61b commit 622ba58
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build-and-publish.yaml
@@ -0,0 +1,40 @@
---
name: Build and Publish

on:
push:
branches:
- redhat-** # IMPORTANT! this must match the jobs.build-and-publish.env.BRANCH_PREFIX (save the **).

jobs:
build-and-publish:
name: Publish container image
env:
BRANCH_PREFIX: redhat- # IMPORTANT! this must match the .on.push.branches prefix!
REGISTRY: quay.io/projectquay
REPO_NAME: ${{ github.event.repository.name }}
runs-on: 'ubuntu-latest'
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set version from branch name
id: version-from-branch
if: startsWith('env.BRANCH_PREFIX', env.GITHUB_REF)
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "::set-output name=version::${BRANCH_NAME/${{ env.BRANCH_PREFIX }}/}"
- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ steps.version-from-branch.outputs.version }}

0 comments on commit 622ba58

Please sign in to comment.