Update to the latest version #13
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
--- | |
# Based on video "GitHub Packages. Containers in a GitHub repo?"" <https://www.youtube.com/watch?v=gqseP_wTZsk> | |
# TODO: DockerHub integration, see e.g. https://github.com/docker/metadata-action | |
# Builds for the current architecture on each push | |
name: Build on push | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- README.md | |
- LICENSE | |
- .github/workflows/* | |
- .gitignore | |
- helper-scripts/* | |
workflow_dispatch: # will allow running manually | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=ref,event=tag | |
type=ref,event=branch,suffix=-branch | |
# Standard build action: | |
- name: Build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
#labels: ${{ steps.meta.outputs.labels }} | |
# Non-standard using the makefile: | |
#- name: Build | |
# # IMAGE_NAME must match the github repository name | |
# run: make REGISTRY=${{ env.REGISTRY }} IMAGE_NAME=${{ env.IMAGE_NAME }} |