-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (75 loc) · 2.52 KB
/
build.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Gets triggered upon the creation of a new tag
on:
push:
tags:
- 'v*' # Matches tags with the name "v*", i.e. v1.0, v20.15.10
name: Generate Website and add as Release
# Performs the following steps:
# - Install all dependencies (and caches them for future runs)
# - Builds the website
# - Compresses the generated website
# - Packages the generated website
# - Creates a release based on the originating tag
# - Attaches the package to the release
jobs:
build:
name: Generate Website and add as Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
lfs: true
- name: Setup Ruby, Bundler and Jekyll
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Build website
run: |
bundle exec jekyll build -d _site/
- name: Install Minify
run: |
sudo apt-get update
sudo apt-get install minify
- name: Compress entire website
run: |
minify --all --html-keep-document-tags --html-keep-end-tags -r -o _site/ _site/
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Install PurgeCSS and Terser
run: |
npm install -g purgecss
npm install -g terser
- name: Compress CSS with PurgeCSS
run: |
purgecss --config purgecss.config.js
- name: Compress JavaScript with Terser
run: |
terser _site/assets/js/main.js --compress ecma=2015,top_retain=window.conference --mangle --comments false --output _site/assets/js/main.js
- name: Package generated website
run: |
cd _site/
zip -r ../website.zip *
cd ../
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload zipped Website as Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./website.zip
asset_name: website.zip
asset_content_type: application/zip