From 7776f14e63a0799059caf29b9e8c959aa60f3777 Mon Sep 17 00:00:00 2001 From: Sam Gaus Date: Fri, 22 Nov 2024 09:43:38 +0000 Subject: [PATCH] Publish greenbox-data so I can consume from oaf --- .github/workflows/deploy_data.yml | 39 +++++++++++++++++++++++++++++ packages/greenbox-data/package.json | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy_data.yml diff --git a/.github/workflows/deploy_data.yml b/.github/workflows/deploy_data.yml new file mode 100644 index 0000000..07be427 --- /dev/null +++ b/.github/workflows/deploy_data.yml @@ -0,0 +1,39 @@ +name: Deploy KoLmafia script + +on: + push: + branches: [main] + workflow_dispatch: + +env: + node-version: "22" + +jobs: + build: + runs-on: ubuntu-latest + name: Build and Push + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.node-version }} + - run: corepack enable + + - name: Check publish status + id: check + run: | + NEXT_VERSION=$(jq -r '.version' < packages/greenbox-data/package.json) + STATUS=$(curl --write-out '%{http_code}\n' --head --silent --output /dev/null https://registry.npmjs.org/greenbox-data/$NEXT_VERSION) + echo "status=$STATUS" >> "$GITHUB_OUTPUT" + + - name: Publish if necessary + if: ${{ steps.check.outputs.status == '404' }} + run: | + corepack enable + yarn workspace greenbox-data install --immutable + yarn workspace greenbox-data build + yarn workspace greenbox-data npm publish + env: + STATUS: ${{ steps.check.outputs.status }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/packages/greenbox-data/package.json b/packages/greenbox-data/package.json index dd400ee..da94937 100644 --- a/packages/greenbox-data/package.json +++ b/packages/greenbox-data/package.json @@ -1,6 +1,6 @@ { "name": "greenbox-data", - "version": "0.0.0", + "version": "0.0.1", "description": "> TODO: description", "author": "Sam Gaus ", "homepage": "https://github.com/loathers/greenbox#readme",