Update to use branch instead of commit #66
This file contains hidden or 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
| on: | |
| push: | |
| branches: | |
| - "main" | |
| tags: | |
| - "*" | |
| pull_request: | |
| branches: | |
| - "main" | |
| env: | |
| TEST_TAG: corefiling/pdf2html:test | |
| CI_TAG: corefiling/pdf2html:ci-${{ github.run_id }}-${{ github.run_number }} | |
| TAG_TAG: corefiling/pdf2html:${{ github.ref_name }} | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| environment: "PDF2HTML Public Upload Env" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| lfs: true | |
| - name: Set up dotnet | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: "8.x" | |
| - name: Unit tests | |
| run: dotnet test tests/Unit.Tests/Unit.Tests.csproj | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build and export to Docker | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./src/Pdf2Html | |
| load: true | |
| tags: ${{ env.TEST_TAG }} | |
| - name: E2E tests | |
| run: | | |
| docker run --rm --detach -p 8080:8080 --name pdf2html ${{ env.TEST_TAG }} | |
| dotnet test tests/E2E.Tests/E2E.Tests.csproj | |
| docker stop pdf2html | |
| - if: github.ref_name == 'main' || github.ref_type == 'tag' | |
| name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USER }} | |
| password: ${{ secrets.DOCKERHUB_PASS }} | |
| - if: github.ref_name == 'main' || github.ref_type == 'tag' | |
| name: Push to Docker Hub | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./src/Pdf2Html | |
| push: true | |
| tags: ${{ github.ref_type == 'tag' && env.TAG_TAG || env.CI_TAG }} |