54 lines (48 loc) · 1.44 KB
/
gh-pages.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
name: GH Pages
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2.3.1
with:
submodules: true
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.87.0"
- name: Build
run: hugo -v --minify -b http://www.lucassabreu.net.br
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: gh-pages
folder: public
- name: Inactive previews ♻️
uses: actions/github-script@v4
with:
script: |
const deployments = await github.paginate(github.repos.listDeployments, {
owner: context.repo.owner,
repo: context.repo.repo,
});
deployments
.filter(d => d.environment !== 'github-pages')
.map(async (d) => {
await github.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: d.id,
state: 'inactive',
});
github.repos.deleteDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: d.id,
});
});