fix: automated release

This commit is contained in:
sai80082
2024-08-28 01:10:58 +05:30
parent dcad608869
commit f78401721c
4 changed files with 100 additions and 42 deletions
-41
View File
@@ -1,41 +0,0 @@
name: Docker Release
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Extract version from package.json
id: extract_version
run: |
VERSION=$(jq -r '.version' package.json)
echo "Version extracted: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build and push Docker image
run: |
docker build --build-arg VERSION=${{ env.VERSION }} \
-t ghcr.io/${{ github.repository }}:${{ env.VERSION }} \
-t ghcr.io/${{ github.repository }}:latest .
docker push ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }}
+44
View File
@@ -0,0 +1,44 @@
name: ci
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
outputs:
new-release-published: ${{ steps.release.outputs.new-release-published }}
new-release-version: ${{ steps.release.outputs.new-release-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: release
run: npx semantic-release
build:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.new-release-published == 'true'
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
run: |
docker build --build-arg VERSION=${{ needs.release.outputs.new-release-version }} \
-t ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }} \
-t ghcr.io/${{ github.repository }}:latest .
docker push ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }}
+49
View File
@@ -0,0 +1,49 @@
{
"branches": ["main"],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{ "type": "docs", "release": false },
{ "type": "refactor", "release": false},
{ "type": "feat", "release": "minor" },
{ "type": "fix", "release": "patch" },
{ "type": "perf", "release": "patch" },
{ "type": "chore", "release": false }
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "angular",
"writerOpts":{
"headerPartial":"## {{#if isPatch~}} <small>{{~/if~}} 🚀 **Immich Power Tools** {{version}}{{~#if isPatch~}} </small>{{~/if}}"
}
}
],
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
[
"@semantic-release/github",
{
"assets": []
}
],
[
"@semantic-release/git",
{
"assets": ["package.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
["semantic-release-export-data"]
]
}
+7 -1
View File
@@ -1,6 +1,6 @@
{
"name": "immich-power-tools",
"version": "0.1.5",
"version": "0.1.9",
"private": true,
"scripts": {
"dev": "next dev",
@@ -50,6 +50,11 @@
"yet-another-react-lightbox": "^3.21.4"
},
"devDependencies": {
"@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^10.1.7",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^14.0.1",
"@types/node": "^20",
"@types/pg": "^8.11.6",
"@types/react": "^18",
@@ -59,6 +64,7 @@
"eslint": "^8",
"eslint-config-next": "14.2.5",
"postcss": "^8.4.41",
"semantic-release-export-data": "^1.1.0",
"tailwindcss": "^3.4.10",
"typescript": "^5"
}