Docker CI copied from Hylé #1
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 to Artifact Registry | |
on: [push, pull_request] | |
env: | |
IMAGE_NAME: "hyleou" | |
AR_REPO_LOCATION: "europe-west3-docker.pkg.dev" | |
AR_URL: "hyle-413414/hyle-docker" | |
jobs: | |
build_and_push: | |
permissions: | |
contents: "read" | |
id-token: "write" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{env.AR_REPO_LOCATION}}/${{ env.AR_URL }}/${{ env.IMAGE_NAME }} | |
# Will produces tags given this table : | |
# | |
# | Event | Ref | Docker Tags | | |
# |---------------------|-------------------------------|----------------------------| | |
# | `pull_request` | `refs/pull/2/merge` | `pr-2` | | |
# | `push` | `refs/heads/master` | `master` | | |
# | `push` | `refs/heads/releases/v1` | `releases-v1` | | |
# | `push tag` | `refs/tags/v1.2.3` | `v1.2.3`, `latest` | | |
# | `push tag` | `refs/tags/v2.0.8-beta.67` | `v2.0.8-beta.67`, `latest` | | |
# | `workflow_dispatch` | `refs/heads/master` | `master` | | |
- name: Docker Auth | |
id: docker-auth | |
uses: "docker/login-action@v3" | |
with: | |
username: _json_key | |
password: ${{ secrets.GOOGLE_CREDENTIALS }} | |
registry: ${{ env.AR_REPO_LOCATION }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |