Skip to content

Weekly Images Creator #69

Weekly Images Creator

Weekly Images Creator #69

name: 'Weekly Images Creator'
on:
schedule:
- cron: '34 2 * * 1' # Tous les lundis à 02:34 (du matin).
workflow_dispatch:
env:
REGISTRY: 'ghcr.io'
USER_NAME: 'arcaneframework'
DOCKERFILE_IN: './.github/scripts/Dockerfile.in'
DOCKERFILE_OUT: './Dockerfile'
jobs:
build-and-push:
strategy:
fail-fast: false
matrix:
os_base: ['ubuntu-2204']
compiler: ['gcc-12']
dependencies: ['full', 'minimal']
build_type: ['release', 'debug', 'check']
exclude:
- os_base: 'ubuntu-2204'
compiler: 'gcc-12'
dependencies: 'minimal'
build_type: 'check'
name: arcane_${{ matrix.os_base }}:${{ matrix.compiler }}_${{ matrix.dependencies }}_${{ matrix.build_type }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate Dockerfile
shell: 'bash'
run: |
./.github/scripts/DockerfileGenerator.sh \
--os ${{ matrix.os_base }} \
--compiler ${{ matrix.compiler }} \
--image_version ${{ matrix.dependencies }} \
--build_type ${{ matrix.build_type }} \
--dockerfile_in ${{ env.DOCKERFILE_IN }} \
--dockerfile_out ${{ env.DOCKERFILE_OUT }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.USER_NAME }}/arcane_${{ matrix.os_base }}
labels: |
org.opencontainers.image.title=ArcaneFramework
org.opencontainers.image.description=Arcane Framework Image
org.opencontainers.image.vendor=CEA
tags: |
type=raw, ${{ matrix.compiler }}_${{ matrix.dependencies }}_${{ matrix.build_type }}_latest
type=raw, ${{ matrix.compiler }}_${{ matrix.dependencies }}_${{ matrix.build_type }}_{{date 'YYYYMMDD'}}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: ${{ env.DOCKERFILE_OUT }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Error message
if: ${{ failure() }}
run: echo "::error::Base image unknown, see available images here https://github.com/arcaneframework/framework-ci#images-disponibles"
- name: Upload Dockerfile generated
uses: actions/upload-artifact@v3
with:
name: arcane_${{ matrix.os_base }}_${{ matrix.compiler }}_${{ matrix.dependencies }}_${{ matrix.build_type }}_dockerfile
path: ${{ env.DOCKERFILE_OUT }}
retention-days: 7