50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '3*' # Trigger on version 3.x.x tags
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Node.js v22
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Configure npm for publishing
|
|
run: |
|
|
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
|
|
- name: Get current published version (if any)
|
|
id: current_version
|
|
run: |
|
|
version=$(npm view discord.js-selfbot-v13 version || echo "none")
|
|
echo "version=$version" >> $GITHUB_OUTPUT
|
|
|
|
- name: Deprecate previous version
|
|
if: steps.current_version.outputs.version != 'none'
|
|
run: |
|
|
echo "Deprecating version ${{ steps.current_version.outputs.version }}"
|
|
npm deprecate discord.js-selfbot-v13@${{ steps.current_version.outputs.version }} "Deprecated: Please use the latest version."
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Publish to NPM
|
|
run: npm publish --provenance --access public
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|