-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (85 loc) · 2.6 KB
/
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
name: Build and Release
on:
push:
branches:
- '**'
env:
VERSION: v1.${{ github.run_number }}.0
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Build Environment
# For Windows, ensure Make is available. You might need to install it or use a different build tool.
if: runner.os == 'Windows'
run: |
choco install make
shell: pwsh
- name: Install Dependencies
run: |
# Add any dependencies installation steps here
echo "Installing dependencies..."
- name: Build
run: make
shell: bash
- name: Archive Binary
run: |
mkdir -p artifacts
# Adjust 'mbox2eml' to your actual binary name
if [ "${{ runner.os }}" == "Windows" ]; then
cp mbox2eml.exe artifacts/mbox2eml-windows.exe
elif [ "${{ runner.os }}" == "macOS" ]; then
cp mbox2eml artifacts/mbox2eml-macos
else
cp mbox2eml artifacts/mbox2eml-linux
fi
shell: bash
if: runner.os != 'Windows'
- name: Archive Binary (Windows)
run: |
mkdir artifacts
cp mbox2eml.exe artifacts/mbox2eml-windows.exe
shell: bash
if: runner.os == 'Windows'
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-binary
path: artifacts/
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: release-binaries
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
files: |
release-binaries/ubuntu-latest-binary/mbox2eml-linux
release-binaries/macos-latest-binary/mbox2eml-macos
release-binaries/windows-latest-binary/mbox2eml-windows.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}