name: Release on: push: branches: - main - next - beta permissions: contents: read # for checkout env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} BUILDX_NO_DEFAULT_ATTESTATIONS: 1 jobs: release: name: Release runs-on: ubuntu-latest permissions: contents: write # to be able to publish a GitHub release issues: write # to be able to comment on released issues pull-requests: write # to be able to comment on released pull requests id-token: write # to enable use of OIDC for npm provenance packages: write steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - uses: pnpm/action-setup@v2 with: version: 8 - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: 18 cache: 'pnpm' - name: Set up QEMU uses: docker/setup-qemu-action@v2 with: platforms: 'arm64,amd64' - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Log in to the Container registry uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies run: pnpm install - run: pnpm lint name: linting - run: pnpm test name: testing - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies run: pnpm audit signatures - name: Build package run: pnpm build - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v3 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value={{sha}} type=raw,value={{branch}}-latest type=raw,value=latest,enable={{is_default_branch}} - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} SRCIMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags[0] }} DSTIMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} run: npx semantic-release