-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (87 loc) · 2.36 KB
/
cd.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
name: CD
on:
push:
tags:
- '*'
jobs:
build:
name: Build
strategy:
matrix:
os: [ubuntu-20.04, macos-11, windows-2022]
include:
- os: ubuntu-20.04
binary: target/release/libgcc.so
artifact: amd64-linux
- os: macos-11
binary: target/release/libgcc.dylib
artifact: amd64-darwin
- os: windows-2022
binary: target/release/gcc.dll
artifact: amd64-win32
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Build
run: cargo build -r
- name: Upload module binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.binary }}
release:
name: Release
runs-on: ubuntu-20.04
permissions:
contents: write
needs: build
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Download Linux binary
uses: actions/download-artifact@v3
with:
name: amd64-linux
path: amd64-linux
- name: Download macOS binary
uses: actions/download-artifact@v3
with:
name: amd64-darwin
path: amd64-darwin
- name: Download Windows binary
uses: actions/download-artifact@v3
with:
name: amd64-win32
path: amd64-win32
- name: Prepare package content
run: |
mkdir -pv package
mv -v amd64-linux/libgcc.so package/amd64-linux.so
mv -v amd64-darwin/libgcc.dylib package/amd64-darwin.dylib
mv -v amd64-win32/gcc.dll package/amd64-win32.dll
- name: Transform module definition
run: |
require 'yaml'
mod = YAML.load_file('locenv-module.yml')
mod['version'] = Integer(ENV['GITHUB_REF_NAME'])
mod['program'] = {
'linux' => {
'amd64' => 'amd64-linux.so'
},
'darwin' => {
'amd64' => 'amd64-darwin.dylib'
},
'win32' => {
'amd64' => 'amd64-win32.dll'
}
}
File.open('package/locenv-module.yml', 'w') { |f| f.write mod.to_yaml.gsub("---\n", '') }
shell: ruby {0}
- name: Create package
run: zip -r ../package.zip *
working-directory: package
- name: Create release
uses: softprops/action-gh-release@v1
with:
files: package.zip