-
Notifications
You must be signed in to change notification settings - Fork 4
44 lines (44 loc) · 1.39 KB
/
deploy.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
name: Deploy
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: checkout code
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: |
pwd
cd packages/gatsby-docs
pwd
yarn install
yarn run gatsby --version
yarn gatsby build --prefix-paths
echo Site built and ready to deploy!
- name: Deploy to Github packages
# only deploy when pushing to main
if: ${{(github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && github.ref_name == 'main'}}
run: |
cd packages/gatsby-docs/public
git config --global init.defaultBranch main
pwd
set -v
git init
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com
git add .
echo 'Add completed'.
git commit -m "Deploy commit: ${{ github.sha }}"
echo 'Commit completed.'
git push -f https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git main:gh-pages
echo 'Finished deploying the site.'