Skip to content

Commit e751d55

Browse files
committed
Add GitHub Release to CI
Rename publish action to release
1 parent a1aac80 commit e751d55

File tree

3 files changed

+60
-33
lines changed

3 files changed

+60
-33
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Publish
2+
on:
3+
workflow_run:
4+
workflows: [CI]
5+
branches: [main]
6+
types: [completed]
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
publish:
15+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: pnpm/action-setup@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version-file: ".nvmrc"
23+
registry-url: "https://registry.npmjs.org"
24+
cache: "pnpm"
25+
26+
- name: Install dependencies
27+
run: pnpm install --frozen-lockfile
28+
29+
- name: "Build"
30+
run: pnpm run build
31+
32+
- name: Publish
33+
run: pnpm publish
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
37+
- name: Extract version
38+
id: extractVersion
39+
run: |
40+
version=$(grep '"version"' package.json | sed -E 's/.*"version": "(.*)".*/\1/')
41+
echo "version=$version" >> $GITHUB_OUTPUT
42+
43+
- name: Create tag
44+
uses: actions/github-script@v5
45+
with:
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
script: |
48+
github.rest.git.createRef({
49+
owner: context.repo.owner,
50+
repo: context.repo.repo,
51+
sha: context.sha,
52+
ref: 'refs/tags/v${{ steps.extractVersion.outputs.version }}'
53+
})
54+
55+
- name: Create release
56+
uses: softprops/action-gh-release@v2
57+
with:
58+
tag_name: v${{ steps.extractVersion.outputs.version }}
59+
generate_release_notes: true

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email-viewer",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"license": "MIT",
55
"author": "OreQr",
66
"description": "📧Opens browser with email preview",

0 commit comments

Comments
 (0)