Skip to content

Commit

Permalink
Update WorkerBee github actions yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mtyszczak committed Sep 19, 2024
1 parent 5884a9d commit 479f998
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/npm_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ jobs:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: |
./scripts/publish_by_tag.sh 452 "${{ github.ref_name }}" "dist/hiveio-workerbee-${{ github.ref_name }}.tgz" build dist
cd dist
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} >> .npmrc
./scripts/publish_by_tag.sh 452 "${{ github.ref_name }}" "dist/hiveio-workerbee-${{ github.ref_name }}.tgz" build
npm publish --access public --provenance
10 changes: 7 additions & 3 deletions scripts/publish_by_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
#
# Example usage for project WorkerBee:
#
# ./scripts/publish_by_tag.sh 452 1.27.6-rc5 "dist/hiveio-workerbee-1.27.6-rc5.tgz" build
# ./scripts/publish_by_tag.sh 452 1.27.6-rc5 "dist/hiveio-workerbee-1.27.6-rc5.tgz" build dist

set -e

PROJECT_ID=${1:?Missing arg \#1 - GitLab project id}
TAG=${2:?Missing arg \#2 - TAG name}
TGZ_PATH=${3:?Missing arg \#3 - TGZ Artifacts filepath}
JOB_NAME=${4:?Missing arg \#4 - Job name containing the tgz artifacts}
OUTPUT_DIR=${5:?Missing arg \#5 - Output directory}

API_PREFIX="https://gitlab.syncad.com/api/v4/projects/${PROJECT_ID}"

Expand All @@ -31,6 +32,9 @@ echo "Downloading artifact from \"${TGZ_PULL_URL}\" to \"${TARGET_FILEPATH}\""

curl -o "${TARGET_FILEPATH}" "${TGZ_PULL_URL}"

echo "Publishing artifacts to npm with provenance for tag \"${TAG}\""
mkdir -vp "${OUTPUT_DIR}"

echo "Unpacking artifact to \"${OUTPUT_DIR}\""

tar -xvf "${TARGET_FILEPATH}" --strip-components=1 -C "${OUTPUT_DIR}"

npm publish --access public --provenance "${TARGET_FILEPATH}"

0 comments on commit 479f998

Please sign in to comment.