Merge pull request #577 from bigbio/dev #222
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
| name: Build and Push to GitHub Container Registry | |
| on: | |
| push: | |
| branches: [ main, master , dev ] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: bigbio/pmultiqc | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - 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: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract branch name | |
| shell: bash | |
| run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
| - name: Determine Docker tag | |
| id: tag | |
| shell: bash | |
| run: | | |
| if [[ "${{ env.BRANCH_NAME }}" == "main" ]] || [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then | |
| echo "DOCKER_TAG=latest" >> $GITHUB_ENV | |
| else | |
| echo "DOCKER_TAG=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV | |
| fi | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./pmultiqc_service | |
| file: ./pmultiqc_service/Dockerfile | |
| platforms: linux/amd64 | |
| push: true | |
| tags: ghcr.io/bigbio/pmultiqc:${{ env.DOCKER_TAG }} | |
| labels: | | |
| org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| org.opencontainers.image.version=${{ env.DOCKER_TAG }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |