Update GHA #6
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
# Continuous integration testing for ChRIS Plugin. | ||
# https://github.com/FNNDSC/python-chrisapp-template/wiki/Continuous-Integration | ||
name: build | ||
on: | ||
push: | ||
branches: [ main ] | ||
tags: | ||
- "v?[0-9]+.[0-9]+.[0-9]+*" | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
docker.io/${{ github.repository }} | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=pep440,pattern={{version}} | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
# QEMU is used for non-x86_64 builds | ||
- uses: docker/setup-qemu-action@v3 | ||
# buildx adds additional features to docker build | ||
- uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver-opts: network=host | ||
- name: Login to DockerHub | ||
if: github.event_name == 'push' && contains(steps.meta.outputs.tags, 'docker.io') | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Login to GitHub Container Registry | ||
if: github.event_name == 'push' && contains(steps.meta.outputs.tag, 'ghcr.io') | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
if: github.event_name == 'push' | ||
with: | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ teps.meta.outputs.labels }} | ||
Check failure on line 52 in .github/workflows/ci.yml GitHub Actions / buildInvalid workflow file
|
||
# linux/ppc64le not working, see https://github.com/ANTsX/ANTs/issues/1644 | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
- name: Get preferred tag | ||
id: preferred | ||
if: github.ref_type == 'tag' | ||
run: | | ||
echo '${{ fromJSON(steps.meta.outputs.json).tags }}' \ | ||
| jq 'map(select(startswith("ghcr.io") and (endswith("latest") | not))).[0]' \ | ||
| xargs printf "tag=%s\n" | ||
| tee --append "$GITHUB_OUTPUT" | ||
- name: Upload ChRIS Plugin | ||
id: upload | ||
if: steps.preferred.outcome == 'success' | ||
uses: FNNDSC/upload-chris-plugin@main | ||
with: | ||
dock_image: ${{ steps.preferred.outputs.tag }} | ||
username: ${{ secrets.CHRISPROJECT_USERNAME }} | ||
password: ${{ secrets.CHRISPROJECT_PASSWORD }} | ||
chris_url: https://cube.chrisproject.org/api/v1/ | ||
compute_names: NERC | ||
- name: Update DockerHub description | ||
if: steps.upload.outcome == 'success' | ||
uses: peter-evans/dockerhub-description@v4 | ||
continue-on-error: true # it is not crucial that this works | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
short-description: ${{ steps.upload.outputs.title }} ${{ github.server_url }}/${{ github.repository }} |