From 49b27d90f94a0e4742e771cc68227012fba5a8dc Mon Sep 17 00:00:00 2001 From: Aaron Moat <2937187+AaronMoat@users.noreply.github.com> Date: Tue, 6 Feb 2024 14:00:50 +1100 Subject: [PATCH] Horrible hacks (#1425) * Horrible hacks * jq * Run `skuba format` * sh * Do we have bash? * Tweak * Tweak --------- Co-authored-by: skuba <34733141+seek-oss-ci@users.noreply.github.com> --- .github/workflows/snapshot.yml | 6 +++++- scripts/snapshot-pre-publish.sh | 8 ++++++++ scripts/snapshot-pre-version.sh | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100755 scripts/snapshot-pre-publish.sh create mode 100755 scripts/snapshot-pre-version.sh diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index ed6f07db3..c1bef625d 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -28,10 +28,14 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Setup jq + uses: dcarbone/install-jq-action@v2.1.0 + - name: Publish to npm uses: seek-oss/changesets-snapshot@v0 with: - pre-publish: pnpm run build + pre-version: ./scripts/snapshot-pre-version.sh + pre-publish: ./scripts/snapshot-pre-publish.sh env: GITHUB_TOKEN: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.SEEK_OSS_CI_NPM_TOKEN }} diff --git a/scripts/snapshot-pre-publish.sh b/scripts/snapshot-pre-publish.sh new file mode 100755 index 000000000..5fd671ad1 --- /dev/null +++ b/scripts/snapshot-pre-publish.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +jq -r '.version = "'$(cat .changeset-version)'" + (.version | sub("0.0.0"; ""))' package.json > package.json.tmp +mv package.json.tmp package.json +rm .changeset-version +pnpm run build \ No newline at end of file diff --git a/scripts/snapshot-pre-version.sh b/scripts/snapshot-pre-version.sh new file mode 100755 index 000000000..e716996ad --- /dev/null +++ b/scripts/snapshot-pre-version.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +pnpm changeset version +jq -r '.version' package.json > .changeset-version +git checkout . \ No newline at end of file