|
8 | 8 |
|
9 | 9 | strategy: |
10 | 10 | matrix: |
11 | | - node-version: [18.19.1] |
| 11 | + node-version: [22.23.2] |
12 | 12 |
|
13 | 13 | steps: |
14 | | - - uses: actions/checkout@v1 |
| 14 | + - uses: actions/checkout@v7 |
| 15 | + with: |
| 16 | + persist-credentials: false |
15 | 17 | - name: Use Node.js ${{ matrix.node-version }} |
16 | | - uses: actions/setup-node@v1 |
| 18 | + uses: actions/setup-node@v7 |
17 | 19 | with: |
18 | 20 | node-version: ${{ matrix.node-version }} |
19 | 21 | - name: yarn, build, and test |
|
25 | 27 | NODE_ENV: test |
26 | 28 | LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }} |
27 | 29 | LINEAR_TEAM_ID: ${{ secrets.LINEAR_TEAM_ID }} |
| 30 | + - name: Install the Zapier CLI |
| 31 | + run: | |
| 32 | + npm install --no-save --prefix "$RUNNER_TEMP/cli" zapier-platform-cli@19.1.0 |
| 33 | + echo "$RUNNER_TEMP/cli/node_modules/.bin" >> "$GITHUB_PATH" |
| 34 | + - name: Validate the Zapier schema |
| 35 | + run: | |
| 36 | + yarn zapier-build |
| 37 | + zapier-platform validate --without-style |
| 38 | +
|
| 39 | + version: |
| 40 | + name: Version bump |
| 41 | + if: github.ref_name != 'master' |
| 42 | + runs-on: ubuntu-latest |
| 43 | + timeout-minutes: 5 |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v7 |
| 46 | + with: |
| 47 | + fetch-depth: 0 |
| 48 | + persist-credentials: false |
| 49 | + |
| 50 | + - uses: actions/setup-node@v7 |
| 51 | + with: |
| 52 | + node-version-file: .nvmrc |
| 53 | + |
| 54 | + - name: Require a version bump for shipped changes |
| 55 | + run: | |
| 56 | + git fetch --no-tags origin master |
| 57 | + base=$(git merge-base origin/master HEAD) |
| 58 | +
|
| 59 | + changed=$(git diff --name-only "$base..HEAD" -- src index.js tsconfig.json ':(exclude)src/test') |
| 60 | + git show "$base:package.json" > "$RUNNER_TEMP/base-package.json" |
| 61 | + deps=$(node scripts/dependencies-changed.js "$RUNNER_TEMP/base-package.json" package.json) |
| 62 | +
|
| 63 | + if [ -z "$changed" ] && [ "$deps" = "false" ]; then |
| 64 | + echo "nothing here reaches Zapier, no version bump needed" |
| 65 | + exit 0 |
| 66 | + fi |
| 67 | +
|
| 68 | + git show origin/master:package.json > "$RUNNER_TEMP/master-package.json" |
| 69 | + master_version=$(node -p "JSON.parse(require('fs').readFileSync(process.env.RUNNER_TEMP + '/master-package.json', 'utf8')).version") |
| 70 | + head_version=$(node -p "require('./package.json').version") |
| 71 | +
|
| 72 | + if [ "$master_version" = "$head_version" ]; then |
| 73 | + echo "This branch changes code that reaches Zapier but leaves the version at $head_version." >&2 |
| 74 | + echo "Raise the minor version in package.json and add a matching '## <version>' entry to CHANGELOG.md." >&2 |
| 75 | + exit 1 |
| 76 | + fi |
| 77 | +
|
| 78 | + if [ "$(printf '%s\n%s\n' "$master_version" "$head_version" | sort -V | tail -1)" != "$head_version" ]; then |
| 79 | + echo "Version $head_version is behind master, which is at $master_version. Rebase and bump again." >&2 |
| 80 | + exit 1 |
| 81 | + fi |
| 82 | +
|
| 83 | + if ! grep -q "^## ${head_version}\$" CHANGELOG.md; then |
| 84 | + echo "CHANGELOG.md has no '## ${head_version}' entry, and Zapier reads that entry when the version is promoted." >&2 |
| 85 | + exit 1 |
| 86 | + fi |
| 87 | +
|
| 88 | + echo "version $master_version -> $head_version" |
0 commit comments