feat: Unique app name (#2) #4
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: Container image build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
workflow_dispatch: | |
inputs: | |
push: | |
type: boolean | |
description: 'Push images to Container Registry' | |
required: false | |
default: false | |
env: | |
IMAGE_NAME: deploy-from-github | |
jobs: | |
# Push image to GitHub Packages Container Registry. | |
push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure Buildkit | |
uses: docker/setup-buildx-action@v2 | |
- name: Authenticate with CR | |
uses: docker/login-action@v2 | |
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push == true) }} | |
with: | |
registry: quay.io | |
username: ${{ secrets.CR_USERNAME }} | |
password: ${{ secrets.CR_PASSWORD }} | |
- name: Generate image tag | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{secrets.CR_URL}}/caprover-compose | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=ref,event=branch,value={{branch}}-{{date 'YYYYMMDD'}}-{{sha}},enable=${{ github.event_name == 'push' }} | |
- name: Build image | |
uses: docker/build-push-action@v3 | |
with: | |
push: ${{ github.event_name == 'push' || inputs.push == true }} | |
tags: |- | |
${{ secrets.CR_URL }}/caprover-compose:${{ github.sha }} |