Skip to content

Commit 0cc298a

Browse files
Push to Docker when running on "main" and tags
1 parent d2e21fb commit 0cc298a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/docker.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ on:
88

99
env:
1010
TEST_TAG: corefiling/pdf2html:test
11+
CI_TAG: corefiling/pdf2html:ci-${{ github.run_id }}-${{ github.run_number }}
12+
TAG_TAG: corefiling/pdf2html:${{ github.ref_name }}
1113

1214
jobs:
1315
docker:
1416
runs-on: ubuntu-latest
17+
environment: "PDF2HTML Public Upload Env"
1518
steps:
1619
- name: Checkout
1720
uses: actions/checkout@v3
@@ -36,3 +39,16 @@ jobs:
3639
docker run --rm --detach -p 8080:8080 --name pdf2html ${{ env.TEST_TAG }}
3740
dotnet test --filter "FullyQualifiedName=E2E.Tests"
3841
docker stop pdf2html
42+
- if: github.ref_name == 'main' || github.ref_type == 'tag'
43+
name: Login to Docker Hub
44+
uses: docker/login-action@v2
45+
with:
46+
username: ${{ secrets.DOCKERHUB_USER }}
47+
password: ${{ secrets.DOCKERHUB_PASS }}
48+
- if: github.ref_name == 'main' || github.ref_type == 'tag'
49+
name: Push to Docker Hub
50+
uses: docker/build-push-action@v4
51+
with:
52+
context: ./src/Pdf2Html
53+
push: true
54+
tags: ${{ github.ref_type == 'tag' && env.TAG_TAG || env.CI_TAG }}

0 commit comments

Comments
 (0)