Skip to content

Commit c4b13f1

Browse files
committed
Fix CI publish workflow
1 parent 4fac65c commit c4b13f1

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ on:
1717
required: true
1818
description: Increment version
1919
options:
20+
- ignore
2021
- patch
2122
- minor
2223
- major
@@ -32,7 +33,7 @@ env:
3233
3334
jobs:
3435
release:
35-
name: Increment version
36+
name: Release
3637
runs-on: ubuntu-latest
3738
steps:
3839
- uses: actions/checkout@v6
@@ -48,6 +49,7 @@ jobs:
4849
- run: bun run build
4950
- run: bun run test
5051
- name: Increment versions and push changes
52+
if: ${{ github.event.inputs.increment != 'ignore' }}
5153
run: |
5254
cd ./packages/${{ github.event.inputs.package }}
5355
bun pm version "${{ github.event.inputs.increment }}" --no-git-tag-version
@@ -62,7 +64,4 @@ jobs:
6264
run: |
6365
npm config set provenance true
6466
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
65-
./scripts/publish.sh ./packages/sysopkit --provenance
66-
./scripts/publish.sh ./packages/@sysopkit/linux --provenance
67-
./scripts/publish.sh ./packages/@sysopkit/openwrt --provenance
68-
./scripts/publish.sh ./packages/@sysopkit/cli --provenance
67+
./scripts/publish.sh ./packages/${{ github.event.inputs.package }} --provenance

scripts/publish.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
set -euo pipefail
44

5-
cd packages/sysopkit/
5+
cd "$1"
6+
shift
67

7-
current_version=$(jq -r .version package.json)
8-
package_name=$(jq -r .name package.json)
9-
published_version=$(npm --no-workspaces view "$package_name" version 2>/dev/null || echo "")
8+
CURRENT_VER=$(jq -r .version package.json)
9+
PKG_NAME=$(jq -r .name package.json)
10+
PUBLISHED_VER=$(npm --no-workspaces view "$PKG_NAME" version 2>/dev/null || echo "")
1011

11-
if [[ "$published_version" == "$current_version" ]]; then
12-
echo "Version $current_version already published"
12+
if [[ "$PUBLISHED_VER" == "$CURRENT_VER" ]]; then
1313
exit 0
1414
fi
1515

16-
filename="${PWD}/archive.tgz"
17-
bun pm pack --filename "$filename"
18-
npm --no-workspaces publish "$filename" --access public "$@"
19-
rm -rf "$filename"
16+
ARCHIVE="${PWD}/archive.tgz"
17+
bun pm pack --filename "$ARCHIVE"
18+
npm --no-workspaces publish "$ARCHIVE" --access public "$@"
19+
rm -rf "$ARCHIVE"

0 commit comments

Comments
 (0)