Skip to content

Commit 03b4ef4

Browse files
Merge pull request #3 from quay/PROJQUAY-3310
ci: Create workflow dispatch for releases (PROJQUAY-3310)
2 parents 98bc2fa + 255c71b commit 03b4ef4

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Build and Publish
3+
4+
on:
5+
6+
workflow_dispatch:
7+
# Allows you to run this workflow manually from the Actions tab
8+
inputs:
9+
tag:
10+
description: 'Tag to attach to image'
11+
required: true
12+
13+
jobs:
14+
build-and-publish:
15+
name: Publish container image
16+
env:
17+
BRANCH_PREFIX: redhat- # IMPORTANT! this must match the .on.push.branches prefix!
18+
REGISTRY: quay.io/projectquay
19+
REPO_NAME: ${{ github.event.repository.name }}
20+
TAG_SUFFIX: -unstable
21+
runs-on: 'ubuntu-latest'
22+
steps:
23+
- name: Check out the repo
24+
uses: actions/checkout@v2
25+
26+
- name: Set version from branch name
27+
id: version-from-branch
28+
if: startsWith('env.BRANCH_PREFIX', env.GITHUB_REF)
29+
run: |
30+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
31+
echo "::set-output name=version::${BRANCH_NAME/${{ env.BRANCH_PREFIX }}/}"
32+
- name: Login to Quay.io
33+
uses: docker/login-action@v1
34+
with:
35+
registry: quay.io
36+
username: ${{ secrets.QUAY_USER }}
37+
password: ${{ secrets.QUAY_TOKEN }}
38+
39+
- name: Build and push
40+
id: docker_build
41+
uses: docker/build-push-action@v2
42+
env:
43+
TAG: ${{ steps.version-from-branch.outputs.version }}${{ env.TAG_SUFFIX }}
44+
with:
45+
build-args: channel=stable version=current
46+
push: true
47+
file: Dockerfile
48+
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag || env.TAG }}

0 commit comments

Comments
 (0)