forked from AGWA/git-crypt
-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (62 loc) · 2.2 KB
/
release-macos.yml
File metadata and controls
72 lines (62 loc) · 2.2 KB
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
on:
release:
types: [published]
pull_request:
branches:
- master
workflow_dispatch:
name: Build and Test Release Binary (macOS)
jobs:
build:
name: Build and Test Release Binary
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-15, macos-15-intel ]
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build and Test ${{ matrix.os }} ${{ runner.arch }} binary
run: |
make
chmod +x ./tests/linux/basic-test.sh
./tests/linux/basic-test.sh
- name: Prepare Artifact
id: prep_artifact
run: |
# Use runner.arch which resolves to 'x64' or 'arm64'
FINAL_NAME="git-crypt-${{ github.run_number }}-darwin-${{ runner.arch }}"
# Append '-dev' suffix for non-release builds (e.g., PRs)
if [[ "${{ github.event_name }}" != 'release' ]]; then
FINAL_NAME="${FINAL_NAME}-dev"
fi
echo "Renaming binary to ${FINAL_NAME}"
mv git-crypt "${FINAL_NAME}"
# Set the final name as an output for the next step
echo "artifact_name=${FINAL_NAME}" >> "$GITHUB_OUTPUT"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
# Use the output from the previous step for both the artifact and path
name: ${{ steps.prep_artifact.outputs.artifact_name }}
path: ${{ steps.prep_artifact.outputs.artifact_name }}
upload:
name: Upload Release Binary
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: build
permissions:
# 'contents: write' is required to upload assets to the release
contents: write
steps:
- name: Download all release artifacts
uses: actions/download-artifact@v4
- name: Upload assets to GitHub release
uses: AButler/upload-release-assets@v3.0
with:
# The download action creates subdirectories for each artifact.
# The '**/...' glob pattern searches recursively to find the binaries.
files: '**/git-crypt-*-darwin-*'
repo-token: ${{ secrets.GITHUB_TOKEN }}