Merge pull request #418 from Australian-Imaging-Service/phi-finder-po… #206
Workflow file for this run
This file contains hidden or 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
# This workflows will upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
name: Build release | |
on: | |
push: | |
branches: [ main, develop ] | |
tags: [ '*' ] | |
pull_request: | |
branches: [ main, develop ] | |
workflow_dispatch: # Allow manual triggering by a user with write access to this repo | |
permissions: | |
contents: read | |
packages: write # required for pushing to ghcr.io | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
spec: | |
- quality-control/phi-finder | |
steps: | |
- name: Removed unnecessary tools to free space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y yq | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Get release tag | |
run: | | |
git fetch --prune --unshallow | |
echo "RELEASE=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV | |
- name: Unset header | |
# checkout@v2 adds a header that makes branch protection report errors | |
# because the Github action bot is not a collaborator on the repo | |
run: git config --local --unset http.https://github.com/.extraheader | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Update build tools | |
run: python -m pip install --upgrade pip | |
- name: Install dependencies & pipelines package | |
run: | | |
pip install -r requirements.txt | |
pip install . | |
# pip install git+https://github.com/ReproNim/neurodocker.git@master | |
- name: Login to Docker registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: tclose | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Get the tag of the Docker image to be built | |
id: version | |
run: | | |
SPEC_VERSION=$(yq -r '.version' ./specs/australian-imaging-service/${{ matrix.spec }}.yaml) | |
PIPELINE_NAME="${{ matrix.spec }}" | |
PIPELINE_NAME="${PIPELINE_NAME//\//.}" | |
IMAGE_TAG=ghcr.io/australian-imaging-service/${PIPELINE_NAME}:${SPEC_VERSION} | |
echo "IMAGE_TAG=$IMAGE_TAG" | |
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
- name: Build and push container images | |
env: | |
P2A_DOCKER_USER: tclose | |
P2A_ACCESS_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
run: > | |
pydra2app make xnat ./specs/australian-imaging-service/${{ matrix.spec }}.yaml | |
--registry ghcr.io --loglevel info | |
--resources-dir ./resources --spec-root ./specs --dont-check-registry --source-package . | |
# --release pipelines-metapackage $RELEASE --tag-latest --check-registry --clean-up | |
- name: List Docker images | |
run: docker images | |
- name: Push built Docker image | |
id: deployable | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
run: docker push ${{ env.IMAGE_TAG }} |