-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (66 loc) · 2.31 KB
/
publishing.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: publishing
on:
push:
branches:
- master
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
jobs:
setup:
name: setup:${{ matrix.site }}
runs-on: ubuntu-18.04
strategy:
matrix:
site: [landing, notadao, tv]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
id: cache
with:
path: sites/${{ matrix.site }}/node_modules
# XXX: Cache will be invalidated any time that any site updates its packages
# It's not ideal, but I haven't found any way to interpolate `${{ matrix.site }}` in `hashFiles(...)`
# FIXME: "Cache not found" but "Cache already exists"
# https://github.com/actions/cache/issues/144
key: ${{ runner.os }}-npm-${{ matrix.site }}-${{ hashFiles('sites/**/package-lock.json') }}-wtf
- uses: actions/setup-node@v1
if: steps.cache.outputs.cache-hit != 'true'
with:
node-version: 12.x
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
make install site=${{ matrix.site }}
publish:
name: release:${{ matrix.site }}
needs: setup
runs-on: ubuntu-18.04
strategy:
matrix:
site: [landing, notadao, tv]
env:
dist_branch: dist/${{ matrix.site }}
tag_name: ${{ matrix.site }}-v1.0.0+latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: sites/${{ matrix.site }}/node_modules
key: ${{ runner.os }}-npm-${{ matrix.site }}-${{ hashFiles('sites/**/package-lock.json') }}
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Prepare git environment
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Publish site to dist branch
run: |
bin/publish.sh ${{ matrix.site }}
- name: Republish landing site to gh-pages branch
if: matrix.site == 'landing'
run: |
cd sites/landing/dist
git push origin HEAD:gh-pages