OSDN Git Service

891c4de1a8ec34e832e96ed29728c129622a3960
[twpd/master.git] / .github / workflows / deploy.yml
1 name: Deploy
2 on: 
3   push:
4     branches:
5       master
6
7 jobs:
8   build:
9     runs-on: ubuntu-latest
10
11     steps:
12       - uses: actions/checkout@v2
13         with:
14           persist-credentials: false
15
16       # https://github.com/actions/cache/blob/master/examples.md#node---yarn
17       - name: "Cache: Get yarn cache directory path"
18         id: yarn-cache-dir-path
19         run: echo "::set-output name=dir::$(yarn cache dir)"
20
21       - name: "Cache: Set up yarn cache"
22         uses: actions/cache@v2
23         id: yarn-cache
24         with:
25           path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
26           key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
27           restore-keys: |
28             ${{ runner.os }}-yarn-
29
30       # https://github.com/actions/cache/blob/master/examples.md#ruby---bundler
31       - name: "Cache: Set up bundler cache"
32         uses: actions/cache@v2
33         with:
34           path: vendor/bundle
35           key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
36           restore-keys: |
37             ${{ runner.os }}-gems-
38
39       - name: Use Node.js
40         uses: actions/setup-node@v1
41         with: { node-version: '12.x' }
42
43       - name: Use Ruby
44         uses: actions/setup-ruby@v1
45         with: { ruby-version: '2.7.1' }
46
47       - name: Setup dependencies
48         run: |
49           yarn --frozen-lockfile
50           bundle config path vendor/bundle
51           bundle install --jobs 4 --retry 3
52
53       - run: yarn build
54
55       - name: Deploy to gh-pages
56         uses: JamesIves/github-pages-deploy-action@releases/v3
57         with:
58           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59           BRANCH: gh-pages
60           FOLDER: _site