-
Notifications
You must be signed in to change notification settings - Fork 12
192 lines (174 loc) · 6.29 KB
/
ci.yml
File metadata and controls
192 lines (174 loc) · 6.29 KB
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
182
183
184
185
186
187
188
189
190
191
192
name: Update release and nightly
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
os_name: linux
arch: x86_64
- os: ubuntu-24.04-arm
os_name: linux
arch: arm64
- os: macos-latest
os_name: osx
arch: arm64
- os: windows-latest
os_name: windows
arch: x86_64
- os: windows-latest
os_name: windows
arch: arm64
fail-fast: false
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- uses: MrcSnm/setup-dlang@v2
with:
compiler: ldc-latest
redub: latest
- name: Build
if: runner.os != 'macOS'
run: |
redub build -b release-debug --prefetch
- name: Build (OSX Universal)
if: runner.os == 'macOS'
run: |
# Build arm64 version
redub build -b release-debug --prefetch --arch=arm64-apple-darwin
mv build/redub build/redub-arm64
# Build x86_64 version
redub build -b release-debug --prefetch --arch=x86_64
mv build/redub build/redub-x86_64
lipo -create build/redub-arm64 build/redub-x86_64 -output build/redub
rm build/redub-arm64 build/redub-x86_64
- name: Rename artifact on Windows
if: runner.os == 'Windows'
run: |
dir
move build/redub.exe redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-windows-${{ matrix.arch }}.exe
- name: Upload artifacts on Windows
uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-windows-${{ matrix.arch }}.exe
path: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-windows-${{ matrix.arch }}.exe
- name: Rename artifact on macOS
if: runner.os == 'macOS'
run: |
ls -R
mv build/redub redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-universal
- name: Upload artifacts on macOS
uses: actions/upload-artifact@v4
if: runner.os == 'macOS'
with:
name: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-universal
path: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-universal
- name: Rename artifact on Linux
if: runner.os == 'Linux'
run: |
ls -R
mv build/redub redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-${{ matrix.arch }}
- name: Upload artifacts on Linux
uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-${{ matrix.arch }}
path: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-${{ matrix.arch }}
# freebsd:
# strategy:
# matrix:
# arch: [x86_64]
# fail-fast: false
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Run FreeBSD VM
# uses: vmactions/freebsd-vm@v1
# with:
# usesh: true
# prepare: |
# pkg install -y dub ldc
# run: |
# dub build -b release
# - uses: actions/upload-artifact@v4
# if: github.ref == 'refs/heads/main'
# with:
# name: redub-freebsd-14.2-x86_64
# path: build
# alpine:
# strategy:
# matrix:
# arch: [x86_64]
# fail-fast: false
# runs-on: ubuntu-latest
# container:
# image: alpine:latest
# defaults:
# run:
# shell: sh
# steps:
# - uses: actions/checkout@v4
# - uses: MrcSnm/setup-dlang@v2
# with:
# compiler: ldc-latest
# redub: 1.25.2
# - name: Build
# run: |
# redub build -b release-debug
# - run: mv build/redub redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-alpine-${{ matrix.arch }}
# - uses: actions/upload-artifact@v4
# with:
# name: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-alpine-${{ matrix.arch }}
# path: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-alpine-${{ matrix.arch }}
update-release:
runs-on: ubuntu-latest
# needs: [build, alpine]
needs: [build]
permissions:
contents: write
steps:
- name: "Download build artifacts"
uses: actions/download-artifact@v4.1.8
with:
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R
- uses: actions/checkout@v4
with:
path: repository
fetch-depth: 0
fetch-tags: true
- name: Get latest tag for nightly
if: startsWith(github.ref, 'refs/heads/main')
run: |
cd repository
latest=$(git describe --tags --abbrev=0)
echo "latest_tag=$latest" >> $GITHUB_ENV
- name: Get latest tag for release
if: startsWith(github.ref, 'refs/tags/')
run: |
cd repository
latest=$(git describe --tags --abbrev=0 $GITHUB_REF_NAME^)
echo "latest_tag=$latest" >> $GITHUB_ENV
- name: Generate changelog
run: |
cd repository
echo "Describe from ${{ env.latest_tag }} to HEAD"
git log --oneline ${{ env.latest_tag }}..HEAD > ../release_notes.txt
- name: Publish release
uses: ncipollo/release-action@v1
with:
artifacts: "redub-*"
allowUpdates: "true"
tag: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'nightly' }}
name: ${{ startsWith(github.ref, 'refs/tags/') && format('Redub {0}', github.ref_name) || 'Redub Nightly' }}
prerelease: ${{ startsWith(github.ref, 'refs/tags/') && 'false' || 'true' }}
bodyFile: release_notes.txt