Skip to content

Commit d01f3ac

Browse files
committed
ci: Add Docker image publishing on ghcr
1 parent 3d146ef commit d01f3ac

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/publish.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [created]
66

77
jobs:
8-
build-and-publish:
8+
build-and-publish-on-pypi:
99
if: github.event_name == 'release' && github.event.action == 'created'
1010
runs-on: ubuntu-latest
1111
steps:
@@ -23,3 +23,21 @@ jobs:
2323
- name: Publish package
2424
run : |
2525
hatch publish -u __token__ -a ${{ secrets.PYPI_API_TOKEN }}
26+
27+
build-and-publish-on-ghcr:
28+
if: github.event_name == 'release' && github.event.action == 'created'
29+
runs-on: ubuntu-latest
30+
env:
31+
DJANGO_SETTINGS_MODULE: tests.conf.settings.demo
32+
GHCR_IMAGE_NAME: "ghcr.io/pikhovkin/${GITHUB_REPOSITORY:10}"
33+
TAG: ${GITHUB_REF:10}
34+
steps:
35+
- uses: actions/checkout@v3
36+
- name: Docker login
37+
run: echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
38+
- name: Build the Docker image
39+
run: |
40+
docker build -f docker/Dockerfile -t ${{ env.GHCR_IMAGE_NAME }}-demo:${{ env.TAG }} .
41+
- name: Docker push
42+
run: |
43+
docker push ${{ env.GHCR_IMAGE_NAME }}-demo:${{ env.TAG }}

0 commit comments

Comments
 (0)