ci: add docker build to release and publish

ci: add assets to semantic-release
This commit is contained in:
Krise
2023-08-02 20:05:45 +00:00
parent bd902e99fe
commit 466754f8a3
4 changed files with 77 additions and 13 deletions

View File

@@ -20,11 +20,6 @@ jobs:
packages: write packages: write
steps: steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
@@ -37,11 +32,17 @@ jobs:
uses: docker/metadata-action@v3 uses: docker/metadata-action@v3
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,enable=true,priority=600,prefix=v,suffix=,event=tag
- name: Build and push Docker image - name: Set short git commit SHA
uses: docker/build-push-action@v6 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: with:
context: . src: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.short_sha }}
push: true dst: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -9,6 +9,10 @@ on:
permissions: permissions:
contents: read # for checkout contents: read # for checkout
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
release: release:
@@ -24,22 +28,66 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v2
with: with:
version: 8 version: 8
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18 node-version: 18
cache: 'pnpm' 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 - name: Install dependencies
run: pnpm install run: pnpm install
- run: pnpm lint - run: pnpm lint
name: linting name: linting
- run: pnpm test - run: pnpm test
name: testing name: testing
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: pnpm audit signatures 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 - name: Release
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2
.gitignore vendored
View File

@@ -10,7 +10,7 @@ uploads/
.env .env
# Redis files # Redis files
./*.rdb *.rdb
# Code editor files # Code editor files
.vscode .vscode

View File

@@ -18,7 +18,22 @@
"name": "beta", "name": "beta",
"prerelease": true "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": { "publishConfig": {
"access": "public" "access": "public"