-
Notifications
You must be signed in to change notification settings - Fork 8
181 lines (163 loc) · 5.94 KB
/
release_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
175
176
177
178
179
180
181
# This workflow will automatically upload a binary artifact when a release/tag is created
name: Build and upload binary
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
# allow to build manually
workflow_dispatch:
# build automatically when pushing a tag
push:
branches:
- "master"
tags:
- "v*"
jobs:
# ----------------------------------------------------------------------------
# this will checkout and build nim stable from gh repository on manylinux2014 / CentOS 7
build-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
path: "choosenim"
- name: Build binary
run: |
STABLE_NIM=`curl -sSL https://nim-lang.org/channels/stable | xargs`
curl -O https://nim-lang.org/download/nim-$STABLE_NIM-linux_x64.tar.xz
tar -xvJf nim-$STABLE_NIM-linux_x64.tar.xz
NIMPATH=`pwd`/nim-$STABLE_NIM/bin
PATH=$PATH:$NIMPATH
# compile choosenim
ls -lah
cd choosenim
nimble install -y
nimble build --path:$NIMPATH -d:release
ls bin/*
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload binaries to release/tag
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
tag: ${{ github.ref }}
asset_name: choosenim-${{ env.VERSION }}_linux_amd64
file: ${{ runner.workspace }}/choosenim/choosenim/bin/choosenim
build-win32-exe:
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: jiro4989/setup-nim-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build binary
run: |
nimble install -y
nimble build -d:release
dir bin/*
- name: Write release version
run: |
$VERSION = $Env:GITHUB_REF_NAME.Trim("v")
echo $VERSION
"VERSION=$VERSION" >> $env:GITHUB_ENV
- name: Upload binaries to release/tag
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
tag: ${{ github.ref }}
asset_name: choosenim-${{ env.VERSION }}_windows_amd64.exe
file: ${{ runner.workspace }}/choosenim/bin/choosenim.exe
# ----------------------------------------------------------------------------
# this uses choosenim by itself - you may need to build manually if you break choosenim
build-win32:
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: jiro4989/setup-nim-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build binary
run: |
nimble install -y
nimble build -d:release
dir bin/*
mkdir zipfile
mkdir zipfile/choosenim
cp bin/choosenim.exe zipfile/choosenim/
cp scripts/runme.bat zipfile/
Invoke-WebRequest -Uri https://nim-lang.org/download/dlls.zip -OutFile dlls.zip
Expand-Archive -Force dlls.zip windlls
cp windlls/* zipfile/choosenim/
Compress-Archive -Path zipfile/* -Destination choosenim-windows.zip
- name: Write release version
run: |
$VERSION = $Env:GITHUB_REF_NAME.Trim("v")
echo $VERSION
"VERSION=$VERSION" >> $env:GITHUB_ENV
- name: Upload binaries to release/tag
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
tag: ${{ github.ref }}
asset_name: choosenim-${{ env.VERSION }}_windows_amd64.zip
file: ${{ runner.workspace }}/choosenim/choosenim-windows.zip
# ----------------------------------------------------------------------------
# this uses choosenim by itself - you may need to build manually if you break choosenim
build-macos:
runs-on: macos-12
steps:
- uses: actions/checkout@v4
- uses: jiro4989/setup-nim-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build binary
run: |
git config --global --add safe.directory /__w/choosenim/choosenim
nimble install -y
nimble build -d:release -d:staticBuild
ls bin/*
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload binaries to release/tag
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
tag: ${{ github.ref }}
asset_name: choosenim-${{ env.VERSION }}_macosx_amd64
file: ${{ runner.workspace }}/choosenim/bin/choosenim
build-macos_arm64:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: jiro4989/setup-nim-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build binary
run: |
git config --global --add safe.directory /__w/choosenim/choosenim
nimble install -y
nimble build -d:release -d:staticBuild
ls bin/*
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload binaries to release/tag
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
tag: ${{ github.ref }}
asset_name: choosenim-${{ env.VERSION }}_macosx_arm
file: ${{ runner.workspace }}/choosenim/bin/choosenim