forked from adventuregamestudio/ags-manual
-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (171 loc) · 5.72 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Build
on:
- push
- pull_request
- workflow_dispatch
env:
PANDOC_VERSION: "3.0"
jobs:
build:
strategy:
fail-fast: false
matrix:
with-feature:
- --with-chmcmd
shell:
- bash
os:
- macos-13
- ubuntu-22.04
include:
- os: windows-2022
shell: msys2 {0}
with-feature: --with-chmcmd
- os: windows-2022
shell: msys2 {0}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell }}
env:
MSYS: winsymlinks:nativestrict
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup msys2
if: ${{ runner.os == 'Windows' }}
uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
install: >-
autoconf
automake-wrapper
git
make
- name: Setup tangling
run: >
cd /tmp &&
curl -fL https://git.sr.ht/~mew/dram/refs/download/v1.1/dram-1.1.tar.gz |
tar -xvzf - &&
cd dram-1.1 &&
./configure &&
make &&
make install
- name: Download Pandoc
run: >
mkdir -p /tmp/bin &&
cd /tmp/bin &&
dram words='pandoc ${{ runner.os }}' '${{ github.workspace }}/CONTRIBUTING.md' | /bin/sh &&
>> $GITHUB_ENV echo PANDOC="$(echo /tmp/bin/pandoc*)"
- name: Download and install HTML Help Workshop
if: ${{ runner.os == 'Windows' && matrix.with-feature == null }}
run: >
dram words=html-help-workshop '${{ github.workspace }}/CONTRIBUTING.md' | /bin/sh &&
>> $GITHUB_ENV echo 'HHC=/c/Program Files (x86)/HTML Help Workshop/hhc.exe'
- name: Install Automake
if: ${{ runner.os == 'macOS' }}
run: >
brew update &&
brew install automake
- name: Install Free Pascal CHM compiler
if: ${{ matrix.with-feature != null }}
run: |
case ${{ runner.os }} in
macOS)
dram words='chmcmd macOS' '${{ github.workspace }}/CONTRIBUTING.md' | /bin/sh
>> $GITHUB_ENV echo CHMCMD="$(brew --prefix)/bin/chmcmd"
;;
Linux)
mkdir -p /tmp/bin && cd /tmp/bin
dram words='chmcmd Linux' '${{ github.workspace }}/CONTRIBUTING.md' | /bin/sh
>> $GITHUB_ENV echo CHMCMD='/tmp/bin/chmcmd'
;;
Windows)
cd /tmp
dram words='chmcmd Windows' '${{ github.workspace }}/CONTRIBUTING.md' | /bin/sh
>> $GITHUB_ENV echo CHMCMD='/c/FPC/3.2.2/bin/i386-win32/chmcmd.exe'
;;
*)
exit 1
;;
esac
- name: bootstrap
run: ./bootstrap
- name: configure
run: >
mkdir build &&
cd build &&
../configure --prefix=/usr/local ${{ matrix.with-feature }}
- name: distcheck
env:
DISTCHECK_CONFIGURE_FLAGS: ${{ matrix.with-feature }}
run: >
cd build &&
make -j $(($(getconf _NPROCESSORS_ONLN) - 1)) distcheck
- name: stage installation
run: >
cd build &&
make -j $(($(getconf _NPROCESSORS_ONLN) - 1)) DESTDIR=destdir install
- name: Upload release archive
if: ${{ matrix.with-feature != null }}
uses: actions/upload-artifact@v4
with:
name: release_${{ runner.os }}_${{ env.PANDOC_VERSION }}
path: build/ags-manual-*.tar.gz
if-no-files-found: error
- name: Upload website
if: ${{ matrix.with-feature != null }}
uses: actions/upload-artifact@v4
with:
name: website_${{ runner.os }}_${{ env.PANDOC_VERSION }}
path: build/destdir/usr/local/share/ags-manual/website
if-no-files-found: error
- name: Upload CHM file
uses: actions/upload-artifact@v4
with:
name: chm_${{ runner.os }}_${{ env.PANDOC_VERSION }}${{ matrix.with-feature }}
path: build/destdir/usr/local/share/ags-manual/*.chm
if-no-files-found: error
check-and-release:
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup tangling
run: >
cd /tmp &&
curl -fL https://git.sr.ht/~mew/dram/refs/download/v1.1/dram-1.1.tar.gz |
tar -xvzf - &&
cd dram-1.1 &&
./configure &&
make &&
make install
- name: Tangle comparison script
run: |
dram words=diff-dirs '${{ github.workspace }}/CONTRIBUTING.md' > diff-dirs
chmod +x diff-dirs
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Compare website artifacts
working-directory: artifacts
run: ../diff-dirs website_*
- name: Create release and upload assets
if: startsWith(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
artifacts: artifacts/chm_Windows_${{ env.PANDOC_VERSION }}/ags-help.chm,artifacts/release_Linux_${{ env.PANDOC_VERSION }}/ags-manual-*.tar.gz
allowUpdates: true
omitBodyDuringUpdate: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy on GitHub Pages
if: startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: artifacts/website_Linux_${{ env.PANDOC_VERSION }}