Merge pull request #242 from mach3-software/dependabot/github_actions… #197
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
--- | |
# Update MaCh3 container image registry with newest updates | |
name: Image CD | |
# The events that trigger the workflow | |
on: | |
push: | |
branches: | |
- develop | |
tags: | |
- 'v*' | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # KS: Prevents cancellation of remaining jobs if one fails | |
matrix: | |
include: | |
- os: alma9 | |
file: Doc/MaCh3DockerFiles/Alma9/Dockerfile | |
tag_latest: alma9latest | |
installoptions: -j4 | |
- os: rocky9cuda | |
file: Doc/MaCh3DockerFiles/Rocky9/Dockerfile | |
tag_latest: rocky9cudalatest | |
installoptions: -j4 | |
# - os: ubuntu22.04 | |
# file: Doc/MaCh3DockerFiles/Ubuntu22.04/Dockerfile | |
# tag_latest: ubuntu22.04latest | |
# installoptions: -j4 | |
# - os: fedora32 | |
# file: Doc/MaCh3DockerFiles/Fedora32/Dockerfile | |
# tag_latest: fedora32latest | |
# installoptions: -j4 | |
name: Image CD ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to GitHub Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build Docker image | |
run: | | |
if [ "${{ github.ref_type }}" == "tag" ]; then | |
docker build . \ | |
--file "${{ matrix.file }}" \ | |
--tag "ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.os }}${{ github.ref_name }}" \ | |
--build-arg MACH3_VERSION="${{ github.ref_name }}" \ | |
--build-arg INSTALL_OPTIONS="${{ matrix.installoptions }}" | |
else | |
docker build . \ | |
--file "${{ matrix.file }}" \ | |
--tag "ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.tag_latest }}" \ | |
--build-arg MACH3_VERSION="develop" \ | |
--build-arg INSTALL_OPTIONS="${{ matrix.installoptions }}" | |
fi | |
- name: Push Docker image | |
run: | | |
if [ "${{ github.ref_type }}" == "tag" ]; then | |
docker push "ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.os }}${{ github.ref_name }}" | |
else | |
docker push "ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.tag_latest }}" | |
fi | |
- name: Delete old images | |
uses: actions/delete-package-versions@v5 | |
with: | |
package-name: 'mach3' | |
package-type: 'container' | |
min-versions-to-keep: 5 | |
delete-only-untagged-versions: 'true' |