-
Notifications
You must be signed in to change notification settings - Fork 21
130 lines (117 loc) · 4.2 KB
/
main.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
name: Build
on:
push:
paths-ignore:
- '**.md'
branches:
- master
tags:
- '*'
pull_request:
paths-ignore:
- '**.md'
branches:
- master
- rewrite
jobs:
build-tarball:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo.
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup PHP
uses: nanasess/setup-php@v3
with:
php-version: 8.1
- name: PHP Lint
run: if find . -name "*.php" ! -path "./vendor/*" -print0 | xargs -0 -n 1 -P 8 php -l | grep -v "No syntax errors detected"; then exit 1; fi
- name: Setup Env
id: setup
run: |
HASH=$(git rev-parse HEAD | cut -c1-9)
echo "::set-output name=commitHash::$HASH"
VER=$(grep '$_release' wiki.php |awk '{print $3}' |sed "s/';\|'//g")
echo "::set-output name=version::$VER"
- name: Build Tarball
run: |
sudo apt-get install -y gettext
git clone https://github.com/wkpark/moniwiki-wikiseed wikiseed
echo "Update language files..."
(cd locale; sh update-makefile.sh ; make)
(cd local/js/locale; sh update-makefile.sh ; make)
cat <<EXCLUDE >.excludes
.git
.git/*
.gitmodules
.github
.github/*
applets/FreeMind/Makefile
applets/OekakiPlugin/Makefile
applets/TWikiDrawPlugin/Makefile
imgs/plugin/BBS
imgs/plugin/BBS/*
plugin/bbs.php
theme/paper/.git
theme/paper/.git/*
theme/plugin/*
wikihttpd.php
locale/po/*~
.excludes
EXCLUDE
echo "Build tarball..."
tar czvf ../moniwiki-${{ steps.setup.outputs.version }}-${{ steps.setup.outputs.commitHash }}.tgz --owner=root --group=root -X .excludes --transform 's,^\.,moniwiki,' .
mkdir release
mv ../moniwiki-*.tgz release/
(cd release; tar xvf moniwiki-*.tgz)
(cd release; wget https://github.com/wkpark/moniwiki-apserver/releases/download/v0.5/apserver-apache-2.4.54-php-7.4.32.zip)
(cd release; zip -r -g apserver-apache-2.4.54-php-7.4.32.zip moniwiki)
(rm -rf release/moniwiki)
ls -al release
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: moniwiki-${{ steps.setup.outputs.version }}-${{ steps.setup.outputs.commitHash }}
path: |
${{ github.workspace }}/release/moniwiki-*.tgz
${{ github.workspace }}/release/apserver-apache-*.zip
make-release:
name: Create and upload release
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: [build-tarball]
defaults:
run:
shell: bash
steps:
- name: Get Metadata
id: metadata
run: |
## METADATA SCRIPT
echo "::set-output name=version::${GITHUB_REF/refs\/tags\//}"
- name: Download build artifacts
uses: actions/download-artifact@v3
- name: Generate Checksums
run: |
## CHECKSUM GENERATION SCRIPT
shopt -s extglob
echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt
for file in ${{ github.workspace }}/**/@(*.pkg|*.exe|*.deb|*.zip|*.tgz); do
echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt
done
- name: Create Release
id: create_release
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
with:
draft: false
prerelease: ${{ contains(steps.metadata.outputs.version, 'rc') || contains(steps.metadata.outputs.version, 'beta') }}
tag_name: ${{ steps.metadata.outputs.version }}
name: "moniwiki ${{ steps.metadata.outputs.version }}"
body_path: ${{ github.workspace }}/CHECKSUMS.txt
files: |
${{ github.workspace }}/**/*.zip
${{ github.workspace }}/**/*.exe
${{ github.workspace }}/**/*.deb
${{ github.workspace }}/**/*.tgz
${{ github.workspace }}/**/*.pkg