forked from userscripts-manager/userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.17 KB
/
publish.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
name: "Publish user scripts and styles to GitHub Pages"
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
submodules: true
- name: "Set env vars"
run: |
export_ga() {
for _name in "${@}"
do
local _key="${_name%%=*}"
local _value="${_name#*=}"
[ "${_key}" == "${_name}" ] && _value="${!_name}"
export $_key="${_value}"
echo "${_key}=${_value}" >> "${GITHUB_ENV}"
done
}
export_ga GITHUB_SHA_SHORT="$(git rev-parse --short HEAD)"
- name: "Create website resources"
run: |
bash ./manage.sh publish -v "${{ env.GITHUB_SHA_SHORT }}"
- name: "Deploy to GitHub Pages"
if: "success()"
uses: "crazy-max/ghaction-github-pages@v3.1.0"
with:
target_branch: "gh-pages"
build_dir: "dist"
commit_message: "Synchronize website to ${{ env.GITHUB_SHA_SHORT }}"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"