diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06b0612..408c2b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,19 @@ on: + workflow_dispatch: pull_request: + paths: + - 'lib/**' + - 'backend/**' + - 'src/**' + - 'docs/**' + - 'util/**' push: branches: master + paths: + - 'lib/**' + - 'backend/**' + - 'src/**' + - 'docs/**' jobs: build: @@ -46,39 +58,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: "MicroSDeck" - path: release/* - - deploy: - if: github.ref == 'refs/heads/master' - needs: build - name: Deploy Package - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - uses: jdx/mise-action@v2 - - - name: create .npmrc - run: | - echo "//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN} - registry=https://registry.npmjs.org/ - always-auth=true" > ~/.npmrc - - - name: Update Version - run: | - echo -n "-$(git rev-parse --short HEAD)" >> backend/version && \ - node util/versioning.mjs update package.json lib/package.json - - - name: Install, Build & Publish - working-directory: lib - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - run: | - pnpm install && \ - pnpm build && \ - pnpm publish --no-git-checks --tag prerelease + path: release/* \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..ddf5cbb --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,38 @@ +on: + push: + branches: [master] + paths: + - 'lib/**' + +jobs: + deploy: + name: Deploy Package + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: jdx/mise-action@v2 + + - name: create .npmrc + run: | + echo "//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN} + registry=https://registry.npmjs.org/ + always-auth=true" > ~/.npmrc + + - name: Update Version + run: | + echo -n "-$(git rev-parse --short HEAD)" >> backend/version && \ + node util/versioning.mjs update package.json lib/package.json + + - name: Install, Build & Publish + working-directory: lib + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + run: | + pnpm install && \ + pnpm build && \ + pnpm publish --no-git-checks --tag prerelease diff --git a/util/build.mjs b/util/build.mjs index 46a496f..193b159 100644 --- a/util/build.mjs +++ b/util/build.mjs @@ -6,7 +6,9 @@ import { Version, UpdateVersion, ResetVersion } from './versioning.mjs'; import { Logger } from './log.mjs'; import { exit } from 'process'; -import { name as PluginName } from "../plugin.json" with { type: "json" }; +import plugin from "../plugin.json" with { type: "json" }; +const { name: PluginName } = plugin; + import deploy from "../deploy.json" with { type: "json" }; if (process.argv.includes('-h') || process.argv.includes('--help')) {