Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: build and publish workflow (PROJQUAY-2556)
- Loading branch information
1 parent
c4ad61b
commit 622ba58
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |