Skip to content

Commit 1677413

Browse files
authored
Merge pull request #3 from dvcorreia/feat/create-release
feat(ci): create github release and publish prerelease
2 parents b58d471 + 331685c commit 1677413

3 files changed

Lines changed: 36 additions & 13 deletions

File tree

.github/workflows/prerelease.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish npm prerelease
2+
3+
on:
4+
push:
5+
tags:
6+
- "**-*"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish-npm:
13+
runs-on: ubuntu-latest
14+
environment: publish-npm
15+
permissions:
16+
contents: read
17+
id-token: write
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: cachix/install-nix-action@v31
21+
22+
- name: Build package tarball
23+
run: nix build .#nix-eval-tarball
24+
25+
- name: Publish package
26+
run: nix shell nixpkgs#nodejs --command npm publish ./result/nix-eval-*.tgz --access public --tag next

.github/workflows/publish.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
name: Publish npm package
1+
name: Publish npm release
22

33
on:
44
push:
55
tags:
66
- "**"
7+
- "!**-*"
78

89
permissions:
9-
contents: read
10+
contents: write
1011

1112
jobs:
1213
publish-npm:
1314
runs-on: ubuntu-latest
1415
environment: publish-npm
1516
permissions:
16-
contents: read
17+
contents: write
1718
id-token: write
1819
steps:
1920
- uses: actions/checkout@v4
@@ -23,12 +24,9 @@ jobs:
2324
run: nix build .#nix-eval-tarball
2425

2526
- name: Publish package
26-
run: |
27-
nix shell nixpkgs#nodejs --command sh -ceu '
28-
version=$(node -p "require(\"./package.json\").version")
29-
case "$version" in
30-
*-*) tag=${version#*-}; tag=${tag%%.*} ;;
31-
*) tag=latest ;;
32-
esac
33-
npm publish ./result/nix-eval-*.tgz --access public --tag "$tag"
34-
'
27+
run: nix shell nixpkgs#nodejs --command npm publish ./result/nix-eval-*.tgz --access public
28+
29+
- name: Create GitHub release
30+
env:
31+
GH_TOKEN: ${{ github.token }}
32+
run: gh release create "${{ github.ref_name }}" --generate-notes

flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
pkgs.nix-eval-demo
6464
];
6565
packages = [
66-
pkgs.pnpm
6766
pkgs.rustfmt
6867
];
6968
shellHook = ''

0 commit comments

Comments
 (0)