Skip to content

Commit

Permalink
ci: use actions-gh-pages [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
yld-weng committed Mar 24, 2022
1 parent b145e47 commit 2ccf254
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 205 deletions.
37 changes: 23 additions & 14 deletions .github/workflows/deploy-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ on:
default: ''

jobs:
Deploy-to-QA:
Deploy-QA:
runs-on: windows-2019
defaults:
run:
shell: bash
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Cancel Previous Runs
Expand All @@ -33,8 +33,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-cache-
key: ${{ runner.os }}-npm-cache-v4-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-cache-v4-

- name: Gatsby QA Cache
id: gatsby-qa-cache
Expand All @@ -43,20 +43,21 @@ jobs:
path: |
public
.cache
key: ${{ runner.os }}-gatsby-qa-${{ github.run_id }}
restore-keys: ${{ runner.os }}-gatsby-qa-
key: ${{ runner.os }}-gatsby-v4-qa-${{ github.run_id }}
restore-keys: ${{ runner.os }}-gatsby-v4-qa-

- name: Install dependencies
run: npm ci

- name: Set user info
run: |
git config --local user.email "support+actions@github.com"
git config --local user.name "github-actions-bot"
- name: Deploy to QA
run: npm run deploy:qa

git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
- name: Build
run: |
npm run build:qa
rm -f public/CNAME
env:
NODE_OPTIONS: '--max_old_space_size=4096'
EVENT_API_KEY_1: ${{ secrets.EVENT_API_KEY_1 }}
Expand All @@ -67,5 +68,13 @@ jobs:
GATSBY_GH_APP_GITALK_SECRET: ${{ secrets.GATSBY_GH_APP_GITALK_SECRET }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GATSBY_ENV: ${{ secrets.GATSBY_ENV }}


- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GH_TOKEN }}
external_repository: researchdata-sheffield/dataviz-hub2-qa
publish_branch: main
publish_dir: ./public
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ jobs:
GIT_COMMITTER_EMAIL: "support+actions@github.com"

- name: Deploy
run: npm run deploy
run: |
git remote set-url origin https://git:${GH_TOKEN}@github.com/researchdata-sheffield/dataviz-hub2.git
npm run deploy
env:
NODE_OPTIONS: '--max_old_space_size=4096'
EVENT_API_KEY_1: ${{ secrets.EVENT_API_KEY_1 }}
Expand Down
14 changes: 0 additions & 14 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,20 +436,6 @@ module.exports = {
},
/*********** END RSS Feed ************* */
`gatsby-plugin-sass`,
{
resolve: `gatsby-plugin-purgecss`,
options: {
printRejected: true,
develop: true,
tailwind: true,
purgeOnly: [
"src/components/",
"src/pages/",
"src/templates/",
"content/"
]
}
},
{
resolve: "gatsby-plugin-webpack-bundle-analyser-v2",
options: {
Expand Down
Loading

0 comments on commit 2ccf254

Please sign in to comment.