Skip to content

Commit 9280483

Browse files
authored
Merge pull request #2 from guardrails-ai/github-package-setup
manual tag release job
2 parents bcc8a4a + d770469 commit 9280483

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/release.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build SDK
2+
3+
on:
4+
# Only perform manual releases right now
5+
# push:
6+
# branches: [ main ]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
packages: write
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
repository: ${{ github.event.pull_request.head.repo.full_name }}
22+
ref: ${{ github.event.pull_request.head.ref }}
23+
24+
- name: Install Dependencies
25+
run: npm ci
26+
continue-on-error: false
27+
28+
- name: Build
29+
run: npm pack
30+
continue-on-error: false
31+
32+
- name: Tag
33+
run: |
34+
version="v$(jq -r '.version' ./package.json)"
35+
if git rev-parse "$version" >/dev/null 2>&1
36+
then
37+
echo "Version $version already exist!"
38+
echo "Abandoning build..."
39+
echo "To complete this release update the version field in the package.json with an appropriate semantic version."
40+
exit 1
41+
else
42+
git tag "$version"
43+
git push --tags
44+
fi
45+

0 commit comments

Comments
 (0)