66 - " v*"
77
88jobs :
9- verify-and-publish :
10- name : Verify and publish to npm
9+ verify-version :
10+ name : Verify version matches tag
1111 runs-on : ubuntu-latest
12+ outputs :
13+ version : ${{ steps.cargo_version.outputs.cargo_version }}
1214 steps :
1315 - uses : actions/checkout@v4
1416
3638 fi
3739 echo "Versions match: ${{ steps.cargo_version.outputs.cargo_version }}"
3840
41+ - name : Check Unreleased section is empty
42+ run : |
43+ # Extract content between [Unreleased] and the next version section
44+ UNRELEASED=$(awk '/^## \[Unreleased\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md | grep -v '^$' | wc -l)
45+
46+ if [ "$UNRELEASED" -gt 0 ]; then
47+ echo "ERROR: CHANGELOG.md has unreleased changes!"
48+ echo "Please move unreleased changes to the [${{ steps.cargo_version.outputs.cargo_version }}] section before releasing."
49+ exit 1
50+ fi
51+
52+ echo "Unreleased section is empty ✓"
53+
54+ build-cli :
55+ name : Build CLI binary (Linux)
56+ needs : verify-version
57+ runs-on : ubuntu-latest
58+ steps :
59+ - uses : actions/checkout@v4
60+
61+ - name : Install Rust
62+ uses : dtolnay/rust-toolchain@stable
63+
64+ - name : Setup Rust cache
65+ uses : Swatinem/rust-cache@v2
66+
67+ - name : Build CLI
68+ run : cargo build --release --bin quiv
69+
70+ - name : Create tarball
71+ run : |
72+ cd target/release
73+ tar czf quiv-${{ needs.verify-version.outputs.version }}-linux-x86_64.tar.gz quiv
74+ sha256sum quiv-${{ needs.verify-version.outputs.version }}-linux-x86_64.tar.gz > quiv-${{ needs.verify-version.outputs.version }}-linux-x86_64.tar.gz.sha256
75+
76+ - name : Upload binary artifact
77+ uses : actions/upload-artifact@v4
78+ with :
79+ name : linux-binary
80+ path : |
81+ target/release/quiv-${{ needs.verify-version.outputs.version }}-linux-x86_64.tar.gz
82+ target/release/quiv-${{ needs.verify-version.outputs.version }}-linux-x86_64.tar.gz.sha256
83+
84+ publish-npm :
85+ name : Publish to npm
86+ needs : verify-version
87+ runs-on : ubuntu-latest
88+ steps :
89+ - uses : actions/checkout@v4
90+
3991 - name : Install Rust
4092 uses : dtolnay/rust-toolchain@stable
4193 with :
48100 run : curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
49101
50102 - name : Build WASM
51- run : cd quiver-web && . /build.sh
103+ run : ./ quiver-web/build.sh
52104
53105 - name : Setup Node.js
54106 uses : actions/setup-node@v4
@@ -62,3 +114,46 @@ jobs:
62114 npm publish --access public
63115 env :
64116 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
117+
118+ create-release :
119+ name : Create GitHub release
120+ needs : [verify-version, build-cli, publish-npm]
121+ runs-on : ubuntu-latest
122+ permissions :
123+ contents : write
124+ steps :
125+ - uses : actions/checkout@v4
126+
127+ - name : Download binary artifacts
128+ uses : actions/download-artifact@v4
129+ with :
130+ name : linux-binary
131+ path : artifacts
132+
133+ - name : Extract changelog for this version
134+ id : changelog
135+ run : |
136+ VERSION="${{ needs.verify-version.outputs.version }}"
137+
138+ # Extract the section for this version from CHANGELOG.md
139+ awk "/^## \[$VERSION\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md > release_notes.md
140+
141+ # Append npm package link
142+ echo "" >> release_notes.md
143+ echo "---" >> release_notes.md
144+ echo "" >> release_notes.md
145+ echo "**npm package:** https://www.npmjs.com/package/quiver-web/v/$VERSION" >> release_notes.md
146+
147+ # Output for debugging
148+ echo "Release notes:"
149+ cat release_notes.md
150+
151+ - name : Create GitHub Release
152+ uses : softprops/action-gh-release@v2
153+ with :
154+ body_path : release_notes.md
155+ files : |
156+ artifacts/quiv-${{ needs.verify-version.outputs.version }}-linux-x86_64.tar.gz
157+ artifacts/quiv-${{ needs.verify-version.outputs.version }}-linux-x86_64.tar.gz.sha256
158+ draft : false
159+ prerelease : false
0 commit comments