Publish dev #3060
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish dev | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 */12 * * *' | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| npm: | |
| name: npm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Node v24 | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org/ | |
| cache: yarn | |
| cache-dependency-path: yarn.lock | |
| - name: Check previous released version | |
| id: pre-release | |
| run: | | |
| if [[ $(npm view necord@dev version | grep -e "$(jq --raw-output '.version' package.json)-dev.*.$(git rev-parse --short HEAD | cut -b1-3)") ]]; then | |
| echo "release=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "release=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Deprecate old versions | |
| if: steps.pre-release.outputs.release == 'true' | |
| run: 'npx @favware/npm-deprecate --name "*dev*" --package "necord"' | |
| - name: Publish | |
| if: steps.pre-release.outputs.release == 'true' | |
| run: | | |
| npm version --git-tag-version=false $(jq --raw-output '.version' package.json)-dev.$(date +%s).$(git rev-parse --short HEAD) | |
| npm run publish:dev || true |