feat: semantic release

This commit is contained in:
oSumAtrIX 2022-09-30 07:01:49 +02:00 committed by GitHub
parent 502b87387e
commit 67f848245b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 2 deletions

View File

@ -54,7 +54,7 @@ jobs:
latest=${{ startsWith(github.ref, 'refs/heads/main') }}
suffix=-${{ github.sha }}
- name: Build and push Docker image
- name: Build Docker image
id: build
uses: docker/build-push-action@v2
with:
@ -62,6 +62,17 @@ jobs:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: true
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Push Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build
- name: Setup semantic-release
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog @codedependant/semantic-release-docker -D
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release

20
.releaserc Normal file
View File

@ -0,0 +1,20 @@
{
"branches": [
"main",
{
"name": "dev",
"prerelease": true
}
],
"plugins": [
["@semantic-release/commit-analyzer", {
"releaseRules": [
{"type": "build", "release": "patch"}
]
}],
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/github",
"@codedependant/semantic-release-docker"
]
}

20
release.package.js Normal file
View File

@ -0,0 +1,20 @@
module.exports = {
branches: ["main"],
plugins: [
[
"@codedependant/semantic-release-docker",
{
dockerTags: [process.env.IMAGE_TAG],
dockerImage: process.env.IMAGE_NAME,
dockerFile: "Dockerfile",
dockerRegistry: "ghcr.io",
dockerProject: "codedependant",
dockerArgs: {
API_TOKEN: true,
RELEASE_DATE: new Date().toISOString(),
RELEASE_VERSION: "{{next.version}}",
},
},
],
],
};