Bump peaceiris/actions-gh-pages from 3 to 4 (#107) #45
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 Docker Images | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
jobs: | |
build-and-publish: | |
name: Build and publish Docker images to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- 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: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and publish to registry | |
# every PR will trigger a push event on main, so check the push event is actually coming from main | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'yadage/packtivity' | |
id: docker_build_latest | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
tags: | | |
${{ github.repository }}:latest | |
ghcr.io/${{ github.repository }}:latest | |
labels: | | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
- name: Build and publish to registry with release tag | |
if: github.event_name == 'release' && github.event.action == 'published' && github.repository == 'yadage/packtivity' | |
id: docker_build_release | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
tags: | | |
${{ github.repository }}:latest | |
${{ github.repository }}:latest-stable | |
ghcr.io/${{ github.repository }}:latest | |
ghcr.io/${{ github.repository }}:latest-stable | |
labels: | | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
push: true | |
platforms: linux/amd64,linux/arm64 |