-
Notifications
You must be signed in to change notification settings - Fork 9.4k
48 lines (43 loc) · 1.39 KB
/
publish.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
name: Publish nightly
on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
check_date:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v3
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="1 day" ${{ github.sha }}) && echo "should_run=false" >> $GITHUB_OUTPUT
publish:
# Prevent scheduled job from running if...
# 1) this is a fork
# 2) there has not been a change in the last day
if: |
github.event_name != 'schedule' ||
(github.repository == 'GoogleChrome/lighthouse' && ${{ needs.check_date.outputs.should_run != 'false' }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- run: yarn --frozen-lockfile
# Build report bundles needed for publishing.
- run: yarn build-report
- name: Publish to npm
run: |
npm whoami
bash $GITHUB_WORKSPACE/.github/scripts/bump-nightly-version.sh
npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
CI: true