-
Notifications
You must be signed in to change notification settings - Fork 21
54 lines (51 loc) · 1.58 KB
/
publish-release.yml
File metadata and controls
54 lines (51 loc) · 1.58 KB
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
53
54
# This workflow builds and pushes a tagged docker image from the master branch
name: publish-release
on:
push:
tags:
- '*'
env:
GCP_REPO: us-west2-docker.pkg.dev/askdarcel-184805/sheltertech/askdarcel-api
DOCKER_REPO: sheltertechsf/askdarcel-api
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
flavor: |
latest=false
prefix=
suffix=
images: |
${{ env.GCP_REPO }}
${{ env.DOCKER_REPO }}
tags: |
type=semver,pattern={{version}}
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: google-github-actions/auth@v2
# Login to google registry
with:
credentials_json: ${{ secrets.GCP_ARTIFACT_REGISTRY_KEY }}
# Authenticate with Google Cloud
- uses: docker/login-action@v3
with:
registry: us-west2-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCP_ARTIFACT_REGISTRY_KEY }}
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# Build and push to both registries
- uses: docker/build-push-action@v2
with:
push: true
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- run: echo ${{ steps.docker_build.outputs.digest }}