Build Docker Image #36
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: Build Docker Image | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_run: | |
workflows: ["Tests"] | |
branches: [master] | |
types: | |
- completed | |
jobs: | |
release: | |
name: Release GitHub tag | |
runs-on: 'ubuntu-latest' | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
permissions: | |
contents: write | |
outputs: | |
new_tag: ${{ steps.tag_version.outputs.new_tag }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
default_bump: minor | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release with Notes | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
draft: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
push: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
needs: [ release ] | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Login to GitHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_REGISTRY_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push to GitHub | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: ghcr.io/omegion/db-backup:latest,ghcr.io/omegion/db-backup:${{ needs.release.outputs.new_tag }} | |
platforms: linux/amd64,linux/arm64 | |
build-args: VERSION=${{ needs.release.outputs.new_tag }} |