Merge pull request #32 from opensafely-core/evansd-patch-1 #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |