ci(deps): bump actions/checkout from 6 to 7 #214
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
| --- | |
| name: docker | |
| "on": | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| OWNER: ${{ github.repository_owner }} | |
| REPO: ${{ github.event.repository.name }} | |
| ISSUE_TOKEN: ${{ secrets.ISSUE_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: log in to ghcr with PAT (if provided) | |
| if: github.event_name == 'push' && env.ISSUE_TOKEN != '' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ env.ISSUE_TOKEN }} | |
| - name: log in to ghcr with GITHUB_TOKEN (fallback) | |
| if: github.event_name == 'push' && env.ISSUE_TOKEN == '' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ env.OWNER }}/${{ env.REPO }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=sha | |
| - name: build and push docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: ${{ github.event_name == 'push' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: test docker image | |
| if: github.event_name == 'push' | |
| run: | | |
| IMAGE=$(echo "${{ steps.meta.outputs.tags }}" | head -n1) | |
| docker run --rm "$IMAGE" \ | |
| python -c "import harpertoken; print('Import successful')" | |
| docker run --rm "$IMAGE" python -m unittest tests.test_unit |