-
Notifications
You must be signed in to change notification settings - Fork 2
152 lines (132 loc) · 5.36 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
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
name: Build and Release
on:
push:
branches:
- 'main'
tags:
- '*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: amd64
- os: macos-latest
arch: arm64
- os: macos-13
arch: amd64
steps:
- name: Set up Git repository
uses: actions/checkout@v2
- name: Install GitHub CLI
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)
sudo mkdir -p -m 755 /etc/apt/keyrings
wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y
elif [[ "$RUNNER_OS" == "macOS" ]]; then
brew install gh
fi
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22.3' # Specify the Go version
- name: Create directories and build binaries
run: |
chmod +x ./build.sh
./build.sh
- name: List all files in build directory
run: ls build/
# - name: Install Certificate
# if: matrix.os == 'macos-latest' || matrix.os == 'macos-13'
# run: |
# echo "${{ secrets.MACOS_CERTIFICATE }}" | base64 --decode > certificate.p12
# security create-keychain -p "" build.keychain
# security import certificate.p12 -k build.keychain -P "${{ secrets.MACOS_CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign
# security list-keychains -s build.keychain
# security default-keychain -s build.keychain
# security unlock-keychain -p "" build.keychain
# security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain
# - name: Sign Application
# if: matrix.os == 'macos-latest' || matrix.os == 'macos-13'
# run: |
# codesign --deep --force --verbose --sign "Developer ID Application: Your Name (TEAMID)" build/doppelganger_assistant.app
- name: Upload build artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: build-ubuntu-latest
path: build/
- name: Upload build artifacts for macOS
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: build-${{ matrix.os }}-${{ matrix.arch }}
path: build/
- name: Upload build artifacts for macOS (macos-13)
if: matrix.os == 'macos-13'
uses: actions/upload-artifact@v2
with:
name: build-${{ matrix.os }}-${{ matrix.arch }}
path: build/
create_release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Set up Git repository
uses: actions/checkout@v2
- name: Download build artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p build
for os in macos-latest; do
for arch in arm64; do
echo "Downloading build-${os}-${arch}..."
mkdir -p build-${os}-${arch}
gh run download --name build-${os}-${arch} --dir build-${os}-${arch}/ || echo "Failed to download build-${os}-${arch}"
mv build-${os}-${arch}/* build/ || echo "Failed to move files for build-${os}-${arch}"
done
done
echo "Downloading build-macos-13-amd64..."
mkdir -p build-macos-13-amd64
gh run download --name build-macos-13-amd64 --dir build-macos-13-amd64/ || echo "Failed to download build-macos-13-amd64"
mv build-macos-13-amd64/* build/ || echo "Failed to move files for build-macos-13-amd64"
echo "Downloading build-ubuntu-latest..."
mkdir -p build-ubuntu-latest
gh run download --name build-ubuntu-latest --dir build-ubuntu-latest/ || echo "Failed to download build-ubuntu-latest"
mv build-ubuntu-latest/* build/ || echo "Failed to move files for build-ubuntu-latest"
- name: List all files in build directory before upload
run: ls -l build/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v1.0-${{ github.sha }}
release_name: Release ${{ github.sha }}
draft: false
prerelease: false
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -d build ]; then
for file in build/*; do
echo "Uploading $file..."
gh release upload v1.0-${{ github.sha }} "$file" --clobber
sleep 5 # Add a delay between uploads
done
else
echo "Build directory does not exist or is empty."
exit 1
fi
- name: List all files in build directory after upload
run: ls -l build/