-
Notifications
You must be signed in to change notification settings - Fork 11
54 lines (45 loc) · 1.65 KB
/
publish-on-release.yaml
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
# loosley based on https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
#
# a push to "/refs/heads/releases/v1" results in a tag of "releases-v1" per https://github.com/docker/metadata-action#usage
name: Create and publish a Docker image on release
on:
push:
branches: ['release']
workflow_dispatch:
env:
REGISTRY: us-docker.pkg.dev/uwit-mci-iam/containers
OWNER_IMAGE: ${{ github.repository }}
jobs:
build-and-push-image-to-gar:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Compute repository name
id: image_name
run: |
# GH=uwit-iam/nginx-saml-proxy; echo ${GH#*/} returns "nginx-saml-proxy"
echo "IMAGE_NAME=${OWNER_IMAGE#*/}" >> $GITHUB_OUTPUT
- name: Auth to Cloud
uses: 'uwit-iam/action-auth-artifact-registry@main'
with:
credentials: "${{ secrets.MCI_GCLOUD_AUTH_JSON }}"
- name: Extract metadata (tags + labels) for Docker
id: meta
# should this be pinned?
# https://github.com/docker/metadata-action
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ steps.image_name.outputs.IMAGE_NAME }}
- name: Build and push Docker image
# should this be pinned?
# https://github.com/docker/build-push-action
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.output.labels }}