Workflow file for this run
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 tagged images on release | |
on: | |
release: | |
types: [published] | |
env: | |
SINGULARITY_VERSION: "3.8.3" | |
REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
REGISTRY_TOKEN: ${{ secrets.DOCKER_TOKEN }} | |
DOCKER_REGISTRY_LOGIN: "dockerhub.ebi.ac.uk" | |
SINGULARITY_REGISTRY_LOGIN: "oras://dockerhub.ebi.ac.uk" | |
DOCKER_REGISTRY: "dockerhub.ebi.ac.uk/gdp-public/pgsc_calc" | |
SINGULARITY_REGISTRY: "oras://dockerhub.ebi.ac.uk/gdp-public/pgsc_calc/singularity" | |
jobs: | |
build_docker_release: | |
name: build docker release image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out pipeline code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: downcase GITHUB_REPOSITORY | |
run: | | |
echo "REPO=$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_ENV} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
platforms: "linux/amd64,linux/arm64" | |
tags: ghcr.io/${{ env.REPO }}:${{ github.event.release.tag_name }} | |
build_singularity_release: | |
needs: build_docker_release | |
name: build singularity release image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out pipeline code | |
uses: actions/checkout@v3 | |
- name: Cache singularity setup | |
id: cache-singularity | |
uses: actions/cache@v3 | |
with: | |
path: /opt/hostedtoolcache/singularity/${{ env.SINGULARITY_VERSION }}/x64 | |
key: ${{ runner.os }}-singularity-${{ env.SINGULARITY_VERSION }} | |
- name: Set up Singularity | |
uses: eWaterCycle/setup-singularity@v7 | |
if: steps.cache-singularity.outputs.cache-hit != 'true' | |
with: | |
singularity-version: ${{ env.SINGULARITY_VERSION }} | |
- name: Add singularity to path | |
if: steps.cache-singularity.outputs.cache-hit == 'true' | |
run: | | |
echo "/opt/hostedtoolcache/singularity/${{ env.SINGULARITY_VERSION }}/x64/bin" >> $GITHUB_PATH | |
- name: downcase GITHUB_REPOSITORY | |
run: | | |
echo "REPO=$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_ENV} | |
- name: Build singularity image | |
run: singularity build img.sif "docker://ghcr.io/${{ env.REPO }}:${{ github.event.release.tag_name }}" | |
- name: Push singularity image | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | singularity remote login -u "$GITHUB_ACTOR" --password-stdin oras://ghcr.io | |
singularity push img.sif "oras://ghcr.io/${{ env.REPO }}:${{ github.event.release.tag_name }}-singularity" |