Skip to content

CI

CI #341

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
name: Build / Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18, 20, 22 ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm test
success:
name: Success
needs: [build]
runs-on: ubuntu-latest
if: always()
steps:
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
- run: exit 0
publish-npm:
name: Publish / npm
runs-on: ubuntu-latest
needs: [success]
if: github.event_name == 'push'
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.GW2T_RELEASE_APP_ID }}
private-key: ${{ secrets.GW2T_RELEASE_APP_PRIVATE_KEY }}
- name: Checkout Repo
uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
run: npm ci
- name: Setup git user
run: |
git config --global user.email "160784075+gw2treasures-release-bot[bot]@users.noreply.github.com"
git config --global user.name "gw2treasures-release-bot[bot]"
- name: Create Release Pull Request
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
NPM_CONFIG_PROVENANCE: true
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
title: New Release
commit: Create new release
publish: npm run release
setupGitUser: false