-
Notifications
You must be signed in to change notification settings - Fork 7
162 lines (146 loc) · 5.69 KB
/
release.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
name: Takajo Release Automation
on:
workflow_dispatch:
inputs:
release_ver:
required: true
default: "2.x.x"
branch_or_tag:
required: true
default: "main"
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, macos-13]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch_or_tag }}
- name: Setup Nim
uses: jiro4989/setup-nim-action@v2
with:
nim-version: '2.x' # default is 'stable'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Update nimble libraries
run: |
nimble update
- name: Build Takajo binary
if: matrix.os != 'macos-13'
run: |
nimble build -d:release --threads:on
- name: Build Takajo binary for Intel Mac
if: matrix.os == 'macos-13'
run: |
nimble build -d:release --threads:on --os:macosx --cpu:amd64
- name: Package and Zip - Windows
if: matrix.os == 'windows-latest'
run: |
mkdir -p release-binaries
Copy-Item -Path takajo.exe -Destination release-binaries/
mv release-binaries/takajo.exe release-binaries/takajo-${{ github.event.inputs.release_ver }}-win-x64.exe
Copy-Item -Path mitre-attack.json -Destination release-binaries/
Copy-Item -Path pcre64.dll -Destination release-binaries/
Copy-Item -Path sqlite3_64.dll -Destination release-binaries/
Copy-Item -Path templates -Destination release-binaries/ -Recurse
mkdir -p release-binaries/src/takajopkg/web/
Copy-Item -Path src/takajopkg/web/static -Destination release-binaries/src/takajopkg/web/ -Recurse
New-Item -Path release-binaries/src/takajopkg/web/static/js/common.js -ItemType file
- name: Package and Zip - Unix
if: matrix.os != 'windows-latest'
run: |
mkdir -p release-binaries
cp takajo release-binaries/
cp mitre-attack.json release-binaries/
cp -r templates release-binaries/
mkdir -p release-binaries/src/takajopkg/web/
cp -r src/takajopkg/web/static release-binaries/src/takajopkg/web/
mkdir -p release-binaries/src/takajopkg/web/static/js
touch release-binaries/src/takajopkg/web/static/js/common.js
case ${{ matrix.os }} in
'ubuntu-latest')
mv release-binaries/takajo release-binaries/takajo-${{ github.event.inputs.release_ver }}-lin-x64-gnu ;;
'macos-latest')
mv release-binaries/takajo release-binaries/takajo-${{ github.event.inputs.release_ver }}-mac-aarch64 ;;
'macos-13')
mv release-binaries/takajo release-binaries/takajo-${{ github.event.inputs.release_ver }}-mac-x64 ;;
esac
- name: Set Artifact Name
id: set_artifact_name
shell: bash
run: |
case "${{ matrix.os }}" in
'windows-latest')
echo "artifact_name=takajo-${{ github.event.inputs.release_ver }}-win-x64" >> $GITHUB_OUTPUT ;;
'ubuntu-latest')
echo "artifact_name=takajo-${{ github.event.inputs.release_ver }}-lin-x64-gnu" >> $GITHUB_OUTPUT ;;
'macos-latest')
echo "artifact_name=takajo-${{ github.event.inputs.release_ver }}-mac-aarch64" >> $GITHUB_OUTPUT ;;
'macos-13')
echo "artifact_name=takajo-${{ github.event.inputs.release_ver }}-mac-x64" >> $GITHUB_OUTPUT ;;
esac
- name: Upload Zip Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set_artifact_name.outputs.artifact_name }}
path: |
release-binaries/*
- name: Setup node
if: matrix.os == 'macos-latest'
uses: actions/setup-node@v4
with:
node-version: 20
- name: Create PDF
if: matrix.os == 'macos-latest'
run: |
npm i -g md-to-pdf
md-to-pdf ./*.md --md-file-encoding utf-8
mv ./README.pdf ./README-${{ github.event.inputs.release_ver }}-English.pdf
mv ./README-Japanese.pdf ./README-${{ github.event.inputs.release_ver }}-Japanese.pdf
mv ./CHANGELOG.pdf ./CHANGELOG-${{ github.event.inputs.release_ver }}-English.pdf
mv ./CHANGELOG-Japanese.pdf ./CHANGELOG-${{ github.event.inputs.release_ver }}-Japanese.pdf
- name: Upload Document Artifacts
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: documents
path: |
./*.pdf
upload-all-platforms:
needs: release
runs-on: ubuntu-latest
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: all-packages
pattern: takajo-*
merge-multiple: true
- name: Upload Artifacts(all-platforms)
uses: actions/upload-artifact@v4
with:
name: hayabusa-${{ github.event.inputs.release_ver }}-all-platforms
path: all-packages/*
include-hidden-files: true
all-packages-zip:
needs: upload-all-platforms
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: all-packages
pattern: takajo-*
- run: |
ls -lR all-packages
cd all-packages
for dir in */; do
zip -r "${dir%/}.zip" "$dir"
done
- name: Upload Zip Artifacts(all-packages)
uses: actions/upload-artifact@v4
with:
name: all-packages
path: all-packages/*.zip