Skip to content

Commit

Permalink
use semantic release for automated release
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarMulder committed Jul 14, 2022
1 parent b185858 commit 219fbbe
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 32 deletions.
38 changes: 12 additions & 26 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- main
tags:
- '*'

env:
REGISTRY: ghcr.io
Expand All @@ -22,34 +20,22 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 'lts/*'

- name: Install dependencies
run: npm ci

- name: Log in to the Container registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a # v4.0.1
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 # v3.0.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# - uses: google-github-actions/release-please-action@v3
# with:
# release-type: node
# package-name: ${{ env.IMAGE_NAME }}
- name: Build & Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
"release": {
"branches": ["main"]
},
"publish": [
{
"path": "semantic-release-docker",
"name": "ghcr.io/codam-coding-college/internal-clustermap"
}
]
"repository": {
"type": "git",
"url": "https://github.com/codam-coding-college/internal-clustermap.git"
}
}
12 changes: 12 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
branches: ['main'],
plugins: [
['@codedependant/semantic-release-docker', {
dockerTags: ['latest', '{{version}}', '{{major}}-latest', '{{major}}.{{minor}}'],
dockerImage: 'internal-clustermap',
dockerFile: 'Dockerfile',
dockerRegistry: 'ghcr.io',
dockerProject: 'codam-coding-college',
}]
]
}

0 comments on commit 219fbbe

Please sign in to comment.