release: v0.1.30 #38
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: Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # The OIDC ID token is used for authentication with JSR. | |
| packages: write # Required for pushing to GitHub Container Registry | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: v2.x # Run with latest stable Deno. | |
| - run: deno task check | |
| - name: Extract version from deno.json | |
| id: version | |
| run: echo "version=$(deno eval 'console.log(JSON.parse(Deno.readTextFileSync("deno.json")).version)')" >> $GITHUB_OUTPUT | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check if Docker image version exists | |
| id: check_image | |
| run: | | |
| if docker manifest inspect ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }} > /dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Extract metadata for Docker | |
| if: steps.check_image.outputs.exists == 'false' | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=raw,value=latest | |
| type=raw,value=${{ steps.version.outputs.version }} | |
| type=sha,prefix={{branch}}- | |
| - name: Build and push Docker image | |
| if: steps.check_image.outputs.exists == 'false' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |