Skip to content

Commit c438ae3

Browse files
committed
Use unique URLs when doing lighthouse audits
I have used now alias with the commit SHA.
1 parent c6607ce commit c438ae3

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.github/workflows/lighthouse.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,22 @@ jobs:
2626
- name: Install dependencies
2727
run: npm ci
2828

29-
- name: Check if it should deploy to production
29+
- name: Check if it should deploy to production
3030
id: deploy
3131
if: github.ref == 'refs/heads/master'
3232
run: echo "::set-output name=args::--prod"
33-
33+
3434
- name: Deploy to now
3535
run: npx lerna run now --parallel -- -- ${{ steps.deploy.outputs.args }}
3636
env:
3737
NOW_TOKEN: ${{ secrets.NOW_TOKEN }}
3838

39+
- name: Create alias for this deploy
40+
run: npx lerna run now:alias --parallel
41+
env:
42+
COMMIT_SHA: ${{ github.sha }}
43+
NOW_TOKEN: ${{ secrets.NOW_TOKEN }}
44+
3945
lighthouse:
4046
runs-on: ubuntu-latest
4147
needs: deploy
@@ -52,11 +58,11 @@ jobs:
5258
configPath: ./.github/workflows/lighthouserc.json
5359
budgetPath: ./.github/workflows/budget.json
5460
urls: |
55-
https://mars-theme-frontity.worona.now.sh/
56-
https://mars-theme-frontity.worona.now.sh/2016/the-beauties-of-gullfoss/
61+
https://mars-theme-$COMMIT_SHA.now.sh/
62+
https://mars-theme-$COMMIT_SHA.now.sh/2016/the-beauties-of-gullfoss/
5763
env:
58-
LHCI_BUILD_CONTEXT__CURRENT_HASH: ${{ github.sha }}
5964
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
65+
COMMIT_SHA: ${{ github.sha }}
6066

6167
- name: Save results
6268
uses: actions/upload-artifact@v1

examples/mars-theme-example/now.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"name": "mars-theme-frontity",
2+
"name": "mars-theme",
3+
"alias": "mars.frontity.org",
34
"version": 2,
45
"builds": [
56
{

examples/mars-theme-example/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "example-mars-theme-example",
2+
"name": "example-mars-theme",
33
"version": "1.2.0",
44
"private": true,
55
"description": "Example of a project using mars-theme.",
@@ -10,7 +10,8 @@
1010
"build:inspect": "node --inspect -r ts-node/register/transpile-only ./node_modules/.bin/frontity build",
1111
"serve": "frontity serve",
1212
"serve:inspect": "node --inspect -r ts-node/register/transpile-only ./node_modules/.bin/frontity serve",
13-
"now": "npx frontity build && npx now --token $NOW_TOKEN"
13+
"now": "npx frontity build && npx now --scope frontity --token $NOW_TOKEN",
14+
"now:alias": "npx now alias --scope frontity --token $NOW_TOKEN mars-theme-$COMMIT_SHA.now.sh"
1415
},
1516
"license": "Apache-2.0",
1617
"dependencies": {

0 commit comments

Comments
 (0)