Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
version-changed: ${{ steps.check.outputs.changed }}
current-version: ${{ steps.check.outputs.current-version }}
previous-version: ${{ steps.check.outputs.previous-version }}
is-prerelease: ${{ steps.check.outputs.is-prerelease }}
npm-tag: ${{ steps.check.outputs.npm-tag }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -30,6 +32,18 @@ jobs:
echo "changed=false" >> $GITHUB_OUTPUT
fi

# Check if this is a pre-release version
if [[ "$current_version" =~ -(alpha|beta|rc|dev|pre|canary|next) ]]; then
echo "is-prerelease=true" >> $GITHUB_OUTPUT
tag="$(echo "$current_version" | cut -d'-' -f2)"
echo "npm-tag=$tag" >> $GITHUB_OUTPUT
echo "Detected pre-release version with tag: $tag"
else
echo "is-prerelease=false" >> $GITHUB_OUTPUT
echo "npm-tag=latest" >> $GITHUB_OUTPUT
echo "Detected stable release version"
fi

build-and-publish:
runs-on: ubuntu-latest
needs: check-version
Expand All @@ -48,14 +62,22 @@ jobs:
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run build
- run: npm publish --provenance --access public
- name: Publish to npm
run: |
if [ "${{ needs.check-version.outputs.is-prerelease }}" == "true" ]; then
npm publish --provenance --access public --tag ${{ needs.check-version.outputs.npm-tag }}
else
npm publish --provenance --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

create-release:
runs-on: ubuntu-latest
needs: [check-version, build-and-publish]
if: needs.build-and-publish.result == 'success'
if:
needs.build-and-publish.result == 'success' && needs.check-version.outputs.is-prerelease ==
'false'
permissions:
contents: write
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,5 @@ This script:
To install the pre-release version:

```bash
npm install @reforge-com/javascript@pre
npm install @reforge-com/javascript
```
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reforge-com/javascript",
"version": "0.0.0-pre.0",
"version": "0.0.0-pre.1",
"description": "Feature Flags & Dynamic Configuration as a Service",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
Expand All @@ -21,7 +21,6 @@
"eslint-plugin-jest": "^26.8.0",
"jest": "^29.0.0",
"jest-fetch-mock": "^3.0.3",
"lint-staged": "^13.2.3",
"prettier": "^3.0.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
Expand Down Expand Up @@ -53,9 +52,6 @@
"url": "https://github.com/reforgehq/sdk-javascript/issues"
},
"homepage": "https://github.com/reforgehq/sdk-javascript#readme",
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
},
"dependencies": {
"uuid": "^9.0.1"
},
Expand Down
17 changes: 0 additions & 17 deletions publish-prerelease.sh

This file was deleted.

24 changes: 0 additions & 24 deletions publish-release.sh

This file was deleted.