Skip to content

Instantly share code, notes, and snippets.

@heyjordn
Created November 15, 2022 15:31
Show Gist options
  • Save heyjordn/c8787a0153007e828c89c3c483e450c3 to your computer and use it in GitHub Desktop.
Save heyjordn/c8787a0153007e828c89c3c483e450c3 to your computer and use it in GitHub Desktop.
Github Release Action for publishing to DockerHub via tags
---
name: "Release"
on:
push:
tags:
- "v*"
jobs:
release-app:
name: Build release image from tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- 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: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: heyjordn/awesome-repo:${{ steps.get_release.outputs.tag_name }}
build-args: |
COMPOSER_GITHUB_TOKEN=${{ secrets.COMPOSER_GITHUB_TOKEN }}
platforms: |
linux/amd64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment