Publish nightly #133
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |