Skip to content

Commit 7cf4edb

Browse files
authored
Merge pull request #9 from binhtran432k/ci/release
ci: enhance semantic release
2 parents e0b5fd5 + cb5886f commit 7cf4edb

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/release.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release
2+
on:
3+
push:
4+
branches: [main]
5+
permissions:
6+
contents: read # for checkout
7+
jobs:
8+
release:
9+
# prevents this action from running on forks
10+
if: github.repository == 'binhtran432k/story-mapping-generator'
11+
permissions:
12+
contents: write # to be able to publish a GitHub release
13+
issues: write # to be able to comment on released issues
14+
pull-requests: write # to be able to comment on released pull requests
15+
id-token: write # to enable use of OIDC for npm provenance
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
- name: Get npm cache directory
21+
id: npm-cache-dir
22+
shell: bash
23+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
24+
- name: Setup NodeJS
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: lts/*
28+
- name: Cache npm
29+
uses: actions/cache@v4
30+
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
31+
with:
32+
path: ${{ steps.npm-cache-dir.outputs.dir }}
33+
key: ${{ runner.os }}-node
34+
restore-keys: |
35+
${{ runner.os }}-node
36+
- name: Semantic Release
37+
run: npx semantic-release
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.github_token }}

.releaserc.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
branches:
2+
- main
3+
plugins:
4+
- "@semantic-release/commit-analyzer"
5+
- "@semantic-release/release-notes-generator"
6+
- "@semantic-release/github"

0 commit comments

Comments
 (0)