Skip to content

refactor: migrate to ghcr for hosting #554

refactor: migrate to ghcr for hosting

refactor: migrate to ghcr for hosting #554

Workflow file for this run

name: build
on:
push:
branches:
- 'master'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build_images:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# The docker_target is a stage within the multistage pipeline
# The tag is what we push to dockerhub under the hamletio/hamlet image
- docker_target: hamlet
suffix: ''
- docker_target: jenkins-agent
suffix: -jenkins
- docker_target: azure-pipelines-agent
suffix: -azpipeline
steps:
- name: Checkout
uses: actions/checkout@v2
- name: docker meta details
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{github.repository}}
flavor: |
latest=auto
suffix=${{ matrix.suffix }},onlatest=true
tags: |
type=edge,branch=master
type=semver,pattern={{version}}
type=sha
- name: Set up Docker
uses: docker/setup-buildx-action@v1
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Push Release
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name == 'scheduled' || startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: ${{ matrix.docker_target }}