-
Notifications
You must be signed in to change notification settings - Fork 33
102 lines (98 loc) · 3.43 KB
/
build.yaml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Site Builder
# This workflow is triggered on pushes to the repository.
on:
push:
branches:
- main
pull_request:
release:
types:
- created
jobs:
build:
runs-on: ubuntu-latest
name: "Build the trypyramid.com website"
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '19.x'
- run: yarn install
- run: yarn lint
- run: yarn build
env:
CI_COMMIT_SHA: ${{ github.sha }}
HUGO_BASEURL: "https://trypyramid.com/"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: built-dist
path: dist
release:
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: build
name: "Publish the released assets"
steps:
- name: Download the dist artifact
uses: actions/download-artifact@v3
with:
name: built-dist
path: built-dist
- name: Zip artifacts
run: cd built-dist && zip -r ../website.zip .
- name: Upload website.zip to Github release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: website.zip
asset_name: website.zip
asset_content_type: application/zip
ghpages:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
name: "Publish the website"
steps:
- name: Setup SSH keys and known_hosts
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
chmod 0700 ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.DEPLOYKEY }}"
- name: Download the dist artifact
uses: actions/download-artifact@v3
with:
name: built-dist
path: built-dist
- name: Push these changes to the pages repository
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
cd built-dist
git init .
git config user.email "[email protected]"
git config user.name "Pylonsbot"
git add -A
git commit -m "Publish the latest version of trypyramid.com: $(date +'%Y-%m-%dT%H:%M')"
git remote add origin [email protected]:Pylons/trypyramid.com-pages.git
git push -f origin HEAD:gh-pages
audit:
runs-on: ubuntu-latest
name: "Audit the NPM packages"
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '19.x'
- run: yarn install
- run: yarn list
- run: yarn audit
continue-on-error: true