forked from dom96/choosenim
-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (132 loc) · 4.19 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
# This workflow will automatically upload a binary artifact when a release/tag is created
name: Build and upload binary
on:
# allow to build manually
workflow_dispatch:
# build automatically when pushing a tag
push:
branches:
- "!*"
tags:
- "v*"
env:
ZIG_SYSTEM_LINKER_HACK: 1
jobs:
build:
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
# Windows builds
- os: windows-latest
target: x86_64-windows-gnu
suffix: windows_amd64
cpu: amd64
args:
- os: windows-latest
target: aarch64-windows-gnu
suffix: windows_arm64
cpu: arm64
args:
# Linux builds
- os: ubuntu-latest
target: aarch64-linux-musl
suffix: linux_arm64
cpu: arm64
args:
- os: ubuntu-latest
target: x86_64-linux-musl
suffix: linux_amd64
cpu: amd64
args:
# MacOS builds
- os: macos-latest
target: aarch64-macos-none
suffix: macosx_arm64
cpu: arm64
args:
- os: macos-latest
target: x86_64-macos-none
suffix: macosx_amd64
cpu: amd64
args:
# Android (Termux)
- os: ubuntu-latest
target: aarch64-linux-musl
suffix: android_arm64
cpu: arm64
args: -d:android
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- name: Setup Nim
uses: jiro4989/setup-nim-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install zig
uses: korandoru/setup-zig@v1
with:
zig-version: 0.11.0
- name: Install dependencies
run: |
nimble install -y zigcc
- name: Build proxy
run: |
nimble -y c src/choosenimpkg/proxyexe -d:zig.target="${{ matrix.target }}" --cpu:"${{ matrix.cpu }}" -d:ci ${{ matrix.args }}
- name: Build binary
run: |
nimble -y build -d:zig.target="${{ matrix.target }}" --cpu:"${{ matrix.cpu }}" -d:ci -d:noBuildProxy ${{ matrix.args }}
- name: Update file name
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
run: mv bin/choosenim bin/choosenim-${{ github.ref_name }}_${{ matrix.suffix }}
- name: Update file name
if: ${{ matrix.os == 'windows-latest' }}
run: mv bin\choosenim.exe bin\choosenim-${{ github.ref_name }}_${{ matrix.suffix }}.exe
- name: Upload binaries to release/tag
if: ${{ github.ref_name != 'vtest' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
file_glob: true
tag: ${{ github.ref }}
file: bin/choosenim-${{ github.ref_name }}_${{ matrix.suffix }}*
- name: Upload artefacts
uses: actions/upload-artifact@v4
with:
name: choosenim-${{ github.ref_name }}_${{ matrix.suffix }}
path: bin/choosenim-${{ github.ref_name }}_${{ matrix.suffix }}*
retention-days: 1
deploy-site:
if: ${{ github.ref_name != 'vtest' }}
name: Deploy site
needs: build
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download workflow artifact
uses: actions/download-artifact@v4
with:
path: site/
- name: Add latest version
run: echo "${{ github.ref_name }}" >> site/stable
- name: Setup Nim
uses: jiro4989/setup-nim-action@v1
with:
nim-version: devel
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Create index
run: nim md2html --out:site/index.html readme.md
- name: Add init script
run: mv scripts/choosenim-unix-init.sh site/init.sh
- name: Create pages artefact
uses: actions/upload-pages-artifact@v3
with:
path: site/
- name: Deploy site
uses: actions/deploy-pages@v4