-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (98 loc) · 3.7 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
89
90
91
92
93
94
95
96
97
98
99
100
on:
push:
branches:
- master
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100
- run: npm ci
- run: npm test
- run: npx gulp
- run: bash <(curl -s https://codecov.io/bash)
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rm -rf dist
name: remove dist folder before running linter
- uses: github/super-linter@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_GITHUB_ACTIONS: 'false' # due to not recognizing of core.setOutput
check-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/github-script@v3
id: pr-files
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
if (!context.payload.pull_request) {
console.log('Not pull request')
return
}
const files = await github.paginate(github.pulls.listFiles, { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number})
if (!files.find(i => i.filename === 'man/swatcher.md')) return
console.log('found and setting output')
core.setOutput('is-documentation-updated', 1)
- run: sudo gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" && bundle install
- run: bundle exec ronn -r man/swatcher.md
if: ${{ steps.pr-files.outputs.is-documentation-updated == true }}
- run: npm ci
- run: npx gulp
- name: check if freshly built dist folder differs from commited one
run: git status --porcelain | tee /dev/stderr | ( ! grep -q '.' )
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: e2e/collect_and_generate.sh
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm ci
- name: check if version is synced and valid
run: |
npm install @babel/core @babel/node semver
cat <<EOF > check_version.js
const assert = require('assert').strict;
const version = require('./version.js').default;
const packageVersion = require('./package.json').version;
const semver = require('semver');
assert.equal(version, packageVersion, 'package.json version should equal to embedded version.js file. This is done to populate help method of executable');
assert.ok(semver.valid(version))
EOF
npx babel-node check_version.js
- uses: del-systems/check-if-version-bumped@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
demo:
runs-on: ubuntu-latest
needs: [check-files, check-version, test]
steps:
- uses: actions/checkout@v2
- run: docker run --entrypoint sh -v "$(realpath .):/data" buildkite/puppeteer:latest /data/demo/render_using_catage.sh
- run: npm ci && dist/index.mjs collect . && dist/index.mjs generate-diff
env:
SWATCHER_S3_SECRET_KEY: ${{ secrets.SWATCHER_S3_SECRET_KEY }}
SWATCHER_S3_REGION: ${{ secrets.SWATCHER_S3_REGION }}
SWATCHER_S3_BUCKET_NAME: ${{ secrets.SWATCHER_S3_BUCKET_NAME }}
SWATCHER_S3_ACCESS_KEY: ${{ secrets.SWATCHER_S3_ACCESS_KEY }}
SWATCHER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
runs-on: ubuntu-latest
needs: [test, demo]
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v2
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
registry: https://npm.pkg.github.com/