Skip to content

Commit 219fbbe

Browse files
committed
use semantic release for automated release
1 parent b185858 commit 219fbbe

File tree

3 files changed

+28
-32
lines changed

3 files changed

+28
-32
lines changed

.github/workflows/deploy-image.yml

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
tags:
8-
- '*'
97

108
env:
119
REGISTRY: ghcr.io
@@ -22,34 +20,22 @@ jobs:
2220
- name: Checkout repository
2321
uses: actions/checkout@v3
2422

23+
- name: Setup Node.js
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: 'lts/*'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
2531
- name: Log in to the Container registry
2632
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2.0.0
2733
with:
2834
registry: ${{ env.REGISTRY }}
2935
username: ${{ github.actor }}
3036
password: ${{ secrets.GITHUB_TOKEN }}
3137

32-
- name: Extract metadata (tags, labels) for Docker
33-
id: meta
34-
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a # v4.0.1
35-
with:
36-
images: |
37-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38-
tags: |
39-
type=ref,event=branch
40-
type=ref,event=pr
41-
type=semver,pattern={{version}}
42-
type=semver,pattern={{major}}.{{minor}}
43-
44-
- name: Build and push Docker image
45-
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 # v3.0.0
46-
with:
47-
context: .
48-
push: ${{ github.event_name != 'pull_request' }}
49-
tags: ${{ steps.meta.outputs.tags }}
50-
labels: ${{ steps.meta.outputs.labels }}
51-
52-
# - uses: google-github-actions/release-please-action@v3
53-
# with:
54-
# release-type: node
55-
# package-name: ${{ env.IMAGE_NAME }}
38+
- name: Build & Release
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
run: npx semantic-release

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@
3636
"release": {
3737
"branches": ["main"]
3838
},
39-
"publish": [
40-
{
41-
"path": "semantic-release-docker",
42-
"name": "ghcr.io/codam-coding-college/internal-clustermap"
43-
}
44-
]
39+
"repository": {
40+
"type": "git",
41+
"url": "https://github.com/codam-coding-college/internal-clustermap.git"
42+
}
4543
}

release.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
branches: ['main'],
3+
plugins: [
4+
['@codedependant/semantic-release-docker', {
5+
dockerTags: ['latest', '{{version}}', '{{major}}-latest', '{{major}}.{{minor}}'],
6+
dockerImage: 'internal-clustermap',
7+
dockerFile: 'Dockerfile',
8+
dockerRegistry: 'ghcr.io',
9+
dockerProject: 'codam-coding-college',
10+
}]
11+
]
12+
}

0 commit comments

Comments
 (0)