Skip to content

Merge pull request #111 from waldronlab/chore/repo-structure-reorg #89

Merge pull request #111 from waldronlab/chore/repo-structure-reorg

Merge pull request #111 from waldronlab/chore/repo-structure-reorg #89

Workflow file for this run

# Release workflow — build and push Docker image on version tags.

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

(Line: 64, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKERHUB_USERNAME != '', (Line: 71, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKERHUB_USERNAME != '', (Line: 81, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKERHUB_USERNAME != ''
# Trigger: push tag v* (e.g. git tag v1.0.0 && git push origin v1.0.0)
# Pushes to GitHub Container Registry (ghcr.io); set DOCKERHUB_* secrets to also push to Docker Hub.
name: Release
on:
push:
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build-and-push:
name: Build and push Docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/bioanalyzer-backend
tags: |
type=ref,event=tag,prefix=v
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push to GHCR
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
- name: Log in to Docker Hub
if: ${{ secrets.DOCKERHUB_USERNAME != '' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for Docker Hub
if: ${{ secrets.DOCKERHUB_USERNAME != '' }}
id: meta-dh
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/bioanalyzer-backend
tags: |
type=ref,event=tag,prefix=v
type=semver,pattern={{version}}
- name: Build and push to Docker Hub
if: ${{ secrets.DOCKERHUB_USERNAME != '' }}
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta-dh.outputs.tags }}
labels: ${{ steps.meta-dh.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64