You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

60 lines
2.2 KiB

name: Publish
# Controls when the workflow will run
on:
# Triggers the workflow on release tag creation in the repository
release:
types: [released]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-and-publish:
runs-on: self-hosted
steps:
- 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: docker_meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
${{ secrets.DATOMS_DOCKER_IMAGE_NAME }}
# generate Docker tags based on the following attributes
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,prefix=,format=short
# https://docs.docker.com/language/java/configure-ci-cd/#optimize-the-workflow
# - name: Cache Docker layers
# uses: actions/cache@v3
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-
- name: Build and push
uses: docker/build-push-action@v3
with:
build-args: |
DATOMS_JS_REGISTRY_USER=${{ secrets.DATOMS_JS_REGISTRY_USER }}
DATOMS_JS_REGISTRY_PASSWORD=${{ secrets.DATOMS_JS_REGISTRY_PASSWORD }}
DATOMS_JS_REGISTRY_EMAIL=${{ secrets.DATOMS_JS_REGISTRY_EMAIL }}
DATOMS_JS_REGISTRY_URL=${{ secrets.DATOMS_JS_REGISTRY_URL }}
CI=${{ secrets.CI }}
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.tags }}