forked from AGWA/git-crypt
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (66 loc) · 2.09 KB
/
release-linux.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
on:
release:
types: [published]
pull_request:
branches:
- master
name: Build and Test Release Binary (Linux)
jobs:
build:
name: Build and Test Release Binary
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libssl-dev vim-common
- name: Build binary
run: make
- name: Run integration tests
run: |
chmod +x ./tests/linux/basic-test.sh
./tests/linux/basic-test.sh
- name: Determine artifacts name
id: artifacts-name
env:
IS_RELEASE: ${{ github.event_name == 'release' }}
run: |
if [ "$IS_RELEASE" = true ]; then
echo "artifacts-name=git-crypt-artifacts" >> $GITHUB_ENV
else
echo "artifacts-name=git-crypt-artifacts-dev" >> $GITHUB_ENV
fi
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifacts-name }}
path: git-crypt
upload:
name: Upload Release Binary
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Download release artifact
uses: actions/download-artifact@v4
with:
name: git-crypt-artifacts
- name: Upload release asset
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require("fs").promises;
const { owner, repo } = context.repo;
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: context.payload.release.id,
name: `git-crypt-${context.payload.release.tag_name}-linux-x86_64`,
data: await fs.readFile('git-crypt'),
});
core.notice(`✅ Uploaded release asset: git-crypt-${context.payload.release.tag_name}-linux-x86_64`);