Merge pull request #21 from QCDIS/2-refactor-of-laserfarm-environment… #74
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: Make | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
schedule: | |
- cron: '0 4 5,25 * *' | |
jobs: | |
configure-workflow: | |
name: Configure workflow | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
matrix: ${{ steps.list-flavors.outputs.matrix }} | |
steps: | |
- id: skip_check | |
name: Configure skip-duplicate-actions | |
uses: fkirc/skip-duplicate-actions@v5 | |
with: | |
paths_ignore: '["**/README.md"]' | |
do_not_skip: '["workflow_dispatch", "schedule", "release"]' | |
- uses: actions/checkout@v4 | |
- id: list-flavors | |
name: List flavors | |
run: | | |
matrix=$(find ./flavors -mindepth 2 -maxdepth 2 -name 'flavor_config.yaml' | xargs yq ea -o=j -I=0 '[.]') | |
echo "matrix={\"include\":$(echo $matrix)}" | tee -a $GITHUB_OUTPUT | |
flavors: | |
name: Flavor ${{ matrix.flavor_name }} | |
uses: ./.github/workflows/make-flavor.yaml | |
needs: [configure-workflow] | |
if: needs.configure-workflow.outputs.should_skip != 'true' | |
with: | |
flavor_name: ${{ matrix.flavor_name }} | |
image_repo: 'ghcr.io/qcdis/naavre' | |
image_version: ${{ github.ref_type == 'tag' && github.ref_name || github.sha }} | |
naavre_version: 'v2.4.2' | |
build_jupyter: ${{ matrix.build_jupyter }} | |
free_disk_space: ${{ matrix.free_disk_space }} | |
strategy: | |
matrix: ${{ fromJson(needs.configure-workflow.outputs.matrix) }} | |
save-base-image-tags: | |
name: Save base image tags | |
runs-on: ubuntu-latest | |
needs: [flavors] | |
if: ${{ github.event_name == 'release' }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate base_image_tags.json | |
run: | | |
find ./flavors -mindepth 2 -maxdepth 2 -name 'flavor_config.yaml' | \ | |
xargs yq ea -o=j '[.] | map({"key": .flavor_name, "value": {"build": "ghcr.io/qcdis/naavre/naavre-cell-build-" + .flavor_name + ":${{ github.ref_name }}", "runtime": "ghcr.io/qcdis/naavre/naavre-cell-runtime-" + .flavor_name + ":${{ github.ref_name }}"}}) | from_entries' \ | |
| tee /tmp/base_image_tags.json | |
- name: Add base_image_tags.json to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: /tmp/base_image_tags.json | |
asset_name: base_image_tags.json | |
tag: ${{ github.ref }} |