Skip to content

Commit

Permalink
refactor: modify github actions and scripts
Browse files Browse the repository at this point in the history
Add action step - cancel previous runs.
Change deploy branch cache id.
Remove flag - GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES.
  • Loading branch information
yld-weng committed Jul 15, 2021
1 parent 9580f5e commit 4876b63
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]

- uses: actions/checkout@v2
# Retrieve cache
- name: Gatsby Cache
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]

- uses: actions/checkout@v2
with:
ref: master

- name: Gatsby Cache
id: gatsby-ci-cache
id: gatsby-deploy-cache
uses: actions/cache@v2
with:
path: |
public
.cache
key: ${{ runner.os }}-gatsby-ci-${{ github.run_id }}
restore-keys: ${{ runner.os }}-gatsby-ci-
key: ${{ runner.os }}-gatsby-deploy-${{ github.run_id }}
restore-keys: ${{ runner.os }}-gatsby-deploy-

- name: Install dependencies
run: npm ci
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]

- uses: actions/checkout@v2
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
Expand Down
6 changes: 2 additions & 4 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ import './src/css/react-tabs.scss'
* the Gatsby browser runtime first starts
*/
export const onClientEntry = () => {
// setTimeout(() => {
// window.location.reload();
// }, 3000)

}

/**
Expand Down Expand Up @@ -79,7 +77,7 @@ export const shouldUpdateScroll = ({
if(location.hash) {
setTimeout(() => {
document.querySelector(`${location.hash}`).scrollIntoView()
}, 500);
}, 800);
}

}
2 changes: 1 addition & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
},
flags: {
FAST_DEV: true,
PRESERVE_WEBPACK_CACHE: true
PRESERVE_FILE_DOWNLOAD_CACHE: true
},
plugins: [
{
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"scripts": {
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"build": "gatsby build",
"build:incremental": "GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true && gatsby build --log-pages",
"build:incremental-windows": "set GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true&&gatsby build --log-pages",
"build:incremental": "gatsby build --log-pages",
"develop-noCache": "gatsby clean && gatsby develop",
"develop": "gatsby develop",
"lint": "npx lint-staged",
Expand All @@ -20,14 +19,13 @@
"test:e2e": "start-server-and-test develop http://localhost:8000 cy:open",
"test:e2e:ci": "start-server-and-test develop http://localhost:8000 cy:run",
"start": "npm run develop",
"serve": "npm run build:incremental-windows && gatsby serve",
"serve-noCache": "gatsby clean && npm run build:incremental-windows && gatsby serve",
"serve": "npm run build:incremental && gatsby serve",
"serve-noCache": "gatsby clean && npm run build:incremental && gatsby serve",
"clean": "gatsby clean",
"gh-pages-script": "gh-pages -d public -r https://[email protected]/researchdata-sheffield/dataviz-hub2.git",
"deploy": "gatsby build && npm run gh-pages-script",
"deploy-noCache": "gatsby clean && npm run deploy",
"deploy:incremental": "npm run build:incremental && npm run gh-pages-script",
"deploy:incremental-windows": "npm run build:incremental-windows && npm run gh-pages-script"
"deploy:incremental": "npm run build:incremental && npm run gh-pages-script"
},
"husky": {
"hooks": {
Expand Down

0 comments on commit 4876b63

Please sign in to comment.