-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (36 loc) · 1.04 KB
/
build_and_publish.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
name: Build docker image and publish
on:
workflow_dispatch:
push:
branches: [main]
workflow_run:
workflows:
- Tests
branches:
- main
types:
- completed
env:
IMAGE_NAME: stata-mp
STATA_LICENSE: ${{ secrets.STATA_LICENSE }}
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3
- uses: opensafely-core/setup-action@v1
with:
install-just: true
- name: Build image
run: just build
- name: Log into GitHub Container Registry
run: docker login https://ghcr.io -u ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
- name: Push image to GitHub Container Registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
docker tag $IMAGE_NAME $IMAGE_ID:v1
docker push $IMAGE_ID:v1
# v1 is also latest currently
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker push $IMAGE_ID:latest