-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 1.99 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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 }}