diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 542c051..7c24903 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -15,17 +15,17 @@ jobs: strategy: matrix: - node-version: [12, 14, 16] + node-version: [24] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - name: Use cached node_modules id: cache - uses: actions/cache@v2 + uses: actions/cache@v5 with: path: node_modules key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }} diff --git a/.github/workflows/release-insiders.yml b/.github/workflows/release-insiders.yml deleted file mode 100644 index 138d078..0000000 --- a/.github/workflows/release-insiders.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Release Insiders - -on: - push: - branches: [master] - -permissions: - contents: read - id-token: write - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [12] - - steps: - - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' - - - name: Use cached node_modules - id: cache - uses: actions/cache@v2 - with: - path: node_modules - key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }} - restore-keys: | - nodeModules- - - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: npm install - env: - CI: true - - - name: Resolve version - id: vars - run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" - - - name: "Version based on commit: 0.0.0-insiders.${{ steps.vars.outputs.sha_short }}" - run: npm version 0.0.0-insiders.${{ steps.vars.outputs.sha_short }} --force --no-git-tag-version - - - name: Publish - run: npm publish --provenance --tag insiders - env: - CI: true - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6a37546 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + branches: [master] + release: + types: [published] + +permissions: + contents: read + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [24] + + steps: + - uses: actions/checkout@v6 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v6 + with: + node-version: ${{ matrix.node-version }} + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + + - name: Install dependencies + run: npm install + + - name: Test + run: npm test + + - name: Resolve release metadata + run: | + if [ "${{ github.event_name }}" = "release" ]; then + echo "RELEASE_KIND=release" >> $GITHUB_ENV + echo "RELEASE_CHANNEL=$(node -e \"let version = require('./package.json').version; let match = /\\d+\\.\\d+\\.\\d+-(.*)(\\.\\d+)?/.exec(version); console.log(match ? match[1] : 'latest')\")" >> $GITHUB_ENV + else + echo "RELEASE_KIND=insiders" >> $GITHUB_ENV + echo "INSIDERS_VERSION=0.0.0-insiders.$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "RELEASE_CHANNEL=insiders" >> $GITHUB_ENV + fi + + - name: Version based on commit + if: env.RELEASE_KIND == 'insiders' + run: npm version "$INSIDERS_VERSION" --force --no-git-tag-version + + - name: Publish + run: npm publish --provenance --tag "$RELEASE_CHANNEL"