-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (76 loc) · 2.21 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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