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: Publish on Github container registry | |
on: | |
workflow_dispatch: | |
release: | |
type: [published] | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- reopened | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
# https://github.com/actions/checkout | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: lowercase image name | |
run: | | |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} | |
- name: Get current release version | |
id: release-version | |
run: | | |
version=$(grep -E '^version += +' pyproject.toml | sed -E 's/.*= +//' | sed "s/['\"]//g") | |
echo "version=${version}" >> $GITHUB_OUTPUT | |
# https://github.com/docker/login-action | |
- name: Log in to the Container registry | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/docker/metadata-action | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest,enable=${{ github.event_name == 'push' || github.event_name == 'pull_request'}} | |
type=raw,value=${{ steps.release-version.outputs.version }},enable=${{ github.event_name == 'release' }} | |
# https://github.com/docker/build-push-action | |
- name: Push Docker image | |
uses: docker/[email protected] | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
outputs: type=image,annotation-index.org.opencontainers.image.description=Serve multi-omics digital objects. |