File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4848 run : poetry run mypy .
4949 - name : Run tests
5050 run : poetry run pytest -v --cov=src
51+ build-and-publish :
52+ runs-on : ubuntu-24.04
53+ needs : test # Ensures tests pass before publishing
54+ if : github.event_name != 'pull_request'
55+ steps :
56+ - name : Checkout repository
57+ uses : actions/checkout@v4
58+
59+ - name : Log in to GitHub Container Registry
60+ uses : docker/login-action@v3
61+ with :
62+ registry : ghcr.io
63+ username : ${{ github.actor }}
64+ password : ${{ secrets.GITHUB_TOKEN }}
65+
66+ - name : Set image tag
67+ id : vars
68+ run : echo "tag=ghcr.io/${{ github.repository }}:${{ github.sha }}" >> $GITHUB_OUTPUT
69+
70+ - name : Build and tag Docker image
71+ run : docker build -t ${{ steps.vars.outputs.tag }} .
72+
73+ - name : Push Docker image
74+ run : docker push ${{ steps.vars.outputs.tag }}
75+
76+ - name : Tag and push latest (on main only)
77+ if : github.ref == 'refs/heads/main'
78+ run : |
79+ docker tag ${{ steps.vars.outputs.tag }} ghcr.io/${{ github.repository }}:latest
80+ docker push ghcr.io/${{ github.repository }}:latest
You can’t perform that action at this time.
0 commit comments