Skip to content

Merge pull request #31 from opensafely-core/Jongmassey-patch-1 #29

Merge pull request #31 from opensafely-core/Jongmassey-patch-1

Merge pull request #31 from opensafely-core/Jongmassey-patch-1 #29

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:latest
docker push $IMAGE_ID:latest