Weekly Images Creator #82
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: '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-2404'] | |
compiler: ['gcc-14'] | |
dependencies: ['full', 'minimal'] | |
build_type: ['release', 'debug', 'check'] | |
exclude: | |
- os_base: 'ubuntu-2404' | |
compiler: 'gcc-14' | |
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@v4 | |
- 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@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
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@v6 | |
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@v4 | |
with: | |
name: arcane_${{ matrix.os_base }}_${{ matrix.compiler }}_${{ matrix.dependencies }}_${{ matrix.build_type }}_dockerfile | |
path: ${{ env.DOCKERFILE_OUT }} | |
retention-days: 7 |