v3.0.3 #44
Workflow file for this run
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: Docker Release | |
on: | |
release: | |
types: [published] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
max-parallel: 1 | |
matrix: | |
image: [odin, valheim] | |
steps: | |
- uses: actions/checkout@v4 # v4 | |
- name: Docker meta | |
id: meta | |
uses: crazy-max/ghaction-docker-meta@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
mbround18/${{ matrix.image }} | |
ghcr.io/mbround18/${{ matrix.image }} | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: mbround18 | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: "JQ: Install" | |
run: | | |
sudo apt-get install -y jq | |
- name: "Cargo Make: Get Latest Version" | |
id: cargo-make | |
run: | | |
echo "version=$(curl -s https://api.github.com/repos/sagiegurari/cargo-make/releases/latest | jq -r '.tag_name')" >> $GITHUB_OUTPUT | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile.${{ matrix.image }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=mbround18/${{ matrix.image }}:buildcache | |
cache-to: type=registry,ref=mbround18/${{ matrix.image }}:buildcache,mode=max | |
build-args: | | |
"GITHUB_SHA=${GITHUB_SHA}" | |
"GITHUB_REF=${GITHUB_REF}" | |
"GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" | |
"CARGO_MAKE_VERSION=${{ steps.cargo-make.outputs.version }}" |