🐳 Release Docker #28
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: 🐳 Release Docker | |
on: | |
workflow_run: | |
workflows: ["🎉 Release Binary"] | |
types: | |
- completed | |
workflow_dispatch: | |
jobs: | |
release-docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: "Get Previous tag" | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ secrets.DOCKERHUB_REPO }}/goctopus | |
tags: | | |
# set latest tag for default branch | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=semver,pattern={{version}},value=${{ steps.previoustag.outputs.tag }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |