-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (93 loc) · 2.67 KB
/
docker.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
89
90
91
92
93
94
95
96
97
98
99
100
101
name: docker
on:
push:
branches: [ master, main ]
pull_request:
types:
- opened
- reopened
- synchronize
- closed
paths-ignore:
- .gitlab-ci.yml
- .github/workflows/test.yml
- .github/workflows/generate.yml
- .github/workflows/automerge.yml
repository_dispatch:
types: [ metanorma/metanorma-docker ]
workflow_dispatch:
concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
pull-requests: write
jobs:
build:
if: ${{ github.event.action != 'closed' }}
runs-on: ubuntu-latest
container:
image: metanorma/metanorma # ${{ inputs.docker-image }}
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.pat_token || github.token }}
submodules: true
- name: Metanorma generate site
uses: actions-mn/build-and-publish@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
destination: artifact
deploy-gh-pages:
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} # inputs.deploy-gh-pages == 'true' &&
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.pat_token || github.token }}
- uses: actions/download-artifact@v3
with:
name: github-pages
path: site
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site
branch: gh-pages
clean-exclude: pr-preview
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
deploy-gh-pages-preview:
if: ${{ github.event_name == 'pull_request' }} # inputs.deploy-gh-pages == 'true' &&
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.pat_token || github.token }}
- uses: actions/download-artifact@v3
with:
name: github-pages
path: site
- uses: rossjrw/pr-preview-action@v1
with:
source-dir: site
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
deploy-gh-pages-cleanup:
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }} # inputs.deploy-gh-pages == 'true' &&
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.pat_token || github.token }}
- uses: rossjrw/pr-preview-action@v1
with:
source-dir: .
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}