Skip to content

Commit 12c4222

Browse files
committed
Add GitHub Actions to build & upload release binaries
Closes: #227
1 parent 1c905fa commit 12c4222

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

.github/workflows/release-linux.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
release:
3+
types: [published]
4+
name: Build Release Binary (Linux)
5+
jobs:
6+
build:
7+
name: Build Release Binary
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
- name: Install dependencies
15+
run: sudo apt install libssl-dev
16+
- name: Build binary
17+
run: make
18+
- name: Upload release artifact
19+
uses: actions/upload-artifact@v3
20+
with:
21+
name: git-crypt-artifacts
22+
path: git-crypt
23+
upload:
24+
name: Upload Release Binary
25+
runs-on: ubuntu-latest
26+
needs: build
27+
permissions:
28+
contents: write
29+
steps:
30+
- name: Download release artifact
31+
uses: actions/download-artifact@v3
32+
with:
33+
name: git-crypt-artifacts
34+
- name: Upload release asset
35+
uses: actions/github-script@v3
36+
with:
37+
github-token: ${{ secrets.GITHUB_TOKEN }}
38+
script: |
39+
const fs = require("fs").promises;
40+
const { repo: { owner, repo }, sha } = context;
41+
await github.repos.uploadReleaseAsset({
42+
owner, repo,
43+
release_id: ${{ github.event.release.id }},
44+
name: 'git-crypt-${{ github.event.release.name }}-linux-x86_64',
45+
data: await fs.readFile('git-crypt'),
46+
});

.github/workflows/release-windows.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
on:
2+
release:
3+
types: [published]
4+
name: Build Release Binary (Windows)
5+
jobs:
6+
build:
7+
name: Build Release Binary
8+
runs-on: windows-2022
9+
permissions:
10+
contents: read
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
- name: Setup msys2
15+
uses: msys2/setup-msys2@v2
16+
with:
17+
msystem: MINGW64
18+
update: true
19+
install: >-
20+
base-devel
21+
msys2-devel
22+
mingw-w64-x86_64-toolchain
23+
mingw-w64-x86_64-openssl
24+
openssl-devel
25+
- name: Build binary
26+
shell: msys2 {0}
27+
run: make LDFLAGS="-static-libstdc++ -static -lcrypto -lws2_32"
28+
- name: Upload release artifact
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: git-crypt-artifacts
32+
path: git-crypt.exe
33+
upload:
34+
name: Upload Release Binary
35+
runs-on: ubuntu-latest
36+
needs: build
37+
permissions:
38+
contents: write
39+
steps:
40+
- name: Download release artifact
41+
uses: actions/download-artifact@v3
42+
with:
43+
name: git-crypt-artifacts
44+
- name: Upload release asset
45+
uses: actions/github-script@v3
46+
with:
47+
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
script: |
49+
const fs = require("fs").promises;
50+
const { repo: { owner, repo }, sha } = context;
51+
await github.repos.uploadReleaseAsset({
52+
owner, repo,
53+
release_id: ${{ github.event.release.id }},
54+
name: 'git-crypt-${{ github.event.release.name }}-x86_64.exe',
55+
data: await fs.readFile('git-crypt.exe'),
56+
});

0 commit comments

Comments
 (0)