-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (53 loc) · 1.55 KB
/
deploy.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
53
54
55
56
name: Build and Publish Image
on:
push:
branches:
- "master"
release:
types: [published]
permissions:
contents: read
packages: write
attestations: write
id-token: write
jobs:
build-publish-prd-image:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build and Publish"
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/kids-first/kf-api-dataservice/kf-api-dataservice:${{ github.ref_name }}
build-publish-dev-image:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v3
with:
fetch-tags: "true"
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set git tag and SHA
run: |
VERSION=$(git tag --sort=committerdate | grep -E '[0-9]' | tail -1 | cut -b 1-7)
SHORT_SHA=${GITHUB_SHA:0:7}
TAG="${VERSION}-${SHORT_SHA}"
echo "TAG=${TAG}" >> $GITHUB_ENV
- name: "Build and Publish"
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/kids-first/kf-api-dataservice/kf-api-dataservice:dev-release-${{ env.TAG }}