diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 7a050e6..ed20551 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -20,11 +20,6 @@ jobs: packages: write steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.release.tag_name }} - - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -37,11 +32,17 @@ jobs: uses: docker/metadata-action@v3 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,enable=true,priority=600,prefix=v,suffix=,event=tag - - name: Build and push Docker image - uses: docker/build-push-action@v6 + - name: Set short git commit SHA + id: vars + run: | + calculatedSha=$(git rev-parse --short ${{ github.sha }}) + echo "::set-output name=short_sha::$calculatedSha" + + - name: Push image + uses: akhilerm/tag-push-action@v2.1.0 with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + src: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.short_sha }} + dst: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2af50cd..5389265 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,10 @@ on: permissions: contents: read # for checkout +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: release: @@ -24,22 +28,66 @@ jobs: 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 + + - 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: Install semantic-release dependencies + run: pnpm add @semantic-release/changelog + + - 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@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 46174e1..95b7b33 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ uploads/ .env # Redis files -./*.rdb +*.rdb # Code editor files .vscode diff --git a/package.json b/package.json index 56f655a..0c8feeb 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,22 @@ "name": "beta", "prerelease": true } - ] + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + "@semantic-release/npm", + [ + "@semantic-release/github", + { + "assets": [ + "dist/**" + ] + } + ] + ], + "preset": "angular" }, "publishConfig": { "access": "public"