Increment version #195
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: Push image | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
push: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
token: ${{ secrets.DOCKERHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3.5.2 | |
- name: Log in to Github container registry | |
uses: docker/login-action@v2.1.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2.1.0 | |
if: ${{ env.token != '' }} | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Github Packages | |
id: meta_github | |
uses: docker/metadata-action@v4.3.0 | |
with: | |
images: ghcr.io/${{ github.actor }}/${{ env.IMAGE_NAME }} | |
flavor: latest=true | |
tags: | | |
type=semver,pattern={{ version }} | |
type=ref,event=tag | |
type=sha | |
type=raw,value=latest,enable={{ is_default_branch }} | |
- name: Extract metadata (tags, labels) for Docker Hub | |
if: ${{ env.token != '' }} | |
id: meta_docker | |
uses: docker/metadata-action@v4.3.0 | |
with: | |
images: clauten/${{ env.IMAGE_NAME }} | |
flavor: latest=true | |
tags: | | |
type=semver,pattern={{ version }} | |
type=ref,event=tag | |
type=sha | |
type=raw,value=latest,enable={{ is_default_branch }} | |
- name: Build and push image to Github Packages | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64 | |
tags: ${{ steps.meta_github.outputs.tags }} | |
labels: ${{ steps.meta_github.outputs.labels }} | |
- name: Build and push image to Docker Hub | |
uses: docker/build-push-action@v4.0.0 | |
if: ${{ env.token != '' }} | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64 | |
tags: ${{ steps.meta_docker.outputs.tags }} | |
labels: ${{ steps.meta_docker.outputs.labels }} |