Update containers.csv #123
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: Push containers to registries | |
on: | |
pull_request_target: | |
types: [closed] | |
paths: | |
- 'container/*/*.yml' | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
outputs: | |
matrix: ${{ steps.export-directories.outputs.matrix }} | |
any_changed: ${{ steps.download-changed-directories.outputs.found_artifact }} | |
if: github.event.pull_request.merged == true | |
steps: | |
- name: Download changed directories | |
id: download-changed-directories | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
workflow: container_build.yml | |
name: 'changed_directories_${{ github.event.pull_request.head.sha }}' | |
name_is_regexp: true | |
path: /tmp | |
if_no_artifact_found: warn | |
- name: Export changed directories | |
id: export-directories | |
run: cat /tmp/changed_directories_${{ github.event.pull_request.head.sha }}/changed_directories.json >> "$GITHUB_OUTPUT" | |
push_docker_containers: | |
needs: setup | |
if: needs.setup.outputs.any_changed == 'true' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout pull request branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup up docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Get basename | |
id: context_basename | |
run: echo "basename=$(basename ${{ matrix.context }})" >> "$GITHUB_OUTPUT" | |
- name: Log in to ghcr.io with docker | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{github.repository_owner}} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to quay.io with docker | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ vars.QUAYIO_USERNAME }} | |
password: ${{ secrets.QUAYIO_TOKEN }} | |
- name: Log in to docker.io with docker | |
uses: docker/login-action@v2 | |
with: | |
registry: docker.io | |
username: ${{ vars.DOCKERIO_USERNAME }} | |
password: ${{ secrets.DOCKERIO_TOKEN }} | |
- name: Build and push docker containers | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ matrix.context }} | |
file: .github/docker.df | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/${{ steps.context_basename.outputs.basename }}_docker:latest | |
quay.io/${{ vars.QUAYIO_USERNAME }}/${{ steps.context_basename.outputs.basename }}_docker:latest | |
docker.io/${{ vars.DOCKERIO_USERNAME }}/${{ steps.context_basename.outputs.basename }}_docker:latest | |
# push_apptainer_containers: | |
# needs: setup | |
# if: needs.setup.outputs.any_changed == 'true' | |
# runs-on: ubuntu-latest | |
# strategy: | |
# fail-fast: false | |
# matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} | |
# permissions: | |
# contents: read | |
# packages: write | |
# | |
# steps: | |
# - name: Checkout pull request branch | |
# uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 0 | |
# | |
# - name: Setup micromamba | |
# uses: mamba-org/setup-micromamba@v1 | |
# with: | |
# environment-name: containers | |
# create-args: apptainer | |
# generate-run-shell: true | |
# | |
# - name: Get basename | |
# id: context_basename | |
# run: echo "basename=$(basename ${{ matrix.context }})" >> "$GITHUB_OUTPUT" | |
# | |
# - name: Build apptainer containers | |
# shell: micromamba-shell {0} | |
# run: | | |
# pushd ${{ matrix.context}}; \ | |
# apptainer build /tmp/${{ steps.context_basename.outputs.basename }}_apptainer.sif ${{ github.workspace }}/.github/apptainer.def; \ | |
# popd | |
# | |
# - name: Log in to ghcr.io with apptainer | |
# shell: micromamba-shell {0} | |
# run: | | |
# apptainer remote login --username ${{ github.repository_owner }} \ | |
# --password ${{ secrets.GITHUB_TOKEN }} \ | |
# docker://ghcr.io/${{ github.repository_owner }} | |
# | |
# - name: Push apptainer containers to ghcr.io | |
# shell: micromamba-shell {0} | |
# run: | | |
# apptainer push \ | |
# /tmp/${{ steps.context_basename.outputs.basename }}_apptainer.sif \ | |
# oras://ghcr.io/${{ github.repository_owner }}/${{ steps.context_basename.outputs.basename }}_apptainer:latest | |
# | |
# - name: Log in to quay.io with apptainer | |
# shell: micromamba-shell {0} | |
# run: | | |
# apptainer remote login --username ${{ vars.QUAYIO_USERNAME }} \ | |
# --password ${{ secrets.QUAYIO_TOKEN }} \ | |
# docker://quay.io/${{ vars.QUAYIO_USERNAME }} | |
# | |
# - name: Push apptainer containers to quay.io | |
# shell: micromamba-shell {0} | |
# run: | | |
# apptainer push \ | |
# /tmp/${{ steps.context_basename.outputs.basename }}_apptainer.sif \ | |
# oras://quay.io/${{ vars.QUAYIO_USERNAME }}/${{ steps.context_basename.outputs.basename }}_apptainer:latest | |
# | |
# - name: Log in to docker.io with apptainer | |
# shell: micromamba-shell {0} | |
# run: | | |
# apptainer remote login --username ${{ vars.DOCKERIO_USERNAME }} \ | |
# --password ${{ secrets.DOCKERIO_TOKEN }} \ | |
# docker://docker.io | |
# | |
# - name: Push apptainer containers to docker.io | |
# shell: micromamba-shell {0} | |
# run: | | |
# apptainer push \ | |
# /tmp/${{ steps.context_basename.outputs.basename }}_apptainer.sif \ | |
# oras://docker.io/${{ vars.DOCKERIO_USERNAME }}/${{ steps.context_basename.outputs.basename }}_apptainer:latest |