44 pull_request :
55 branches :
66 - master
7+ workflow_dispatch :
8+
79name : Build and Test Release Binary (macOS)
10+
811jobs :
912 build :
1013 name : Build and Test Release Binary
1114 runs-on : ${{ matrix.os }}
1215 strategy :
1316 matrix :
14- # https://github.com/actions/runner-images#available-images
15- os : [ macos-13, macos-13-xlarge ] # amd64, arm64
17+ # macos-13 is x64 (Intel), macos-13-xlarge is arm64 (Apple Silicon)
18+ os : [ macos-13, macos-13-xlarge ]
1619 permissions :
1720 contents : read
1821 steps :
1922 - name : Checkout repository
2023 uses : actions/checkout@v4
2124
22- - name : Build ${{ env.RUNNER_OS }} ${{ env.RUNNER_ARCH }} binary
25+ - name : Build and Test ${{ matrix.os }} ${{ runner.arch }} binary
2326 run : |
2427 make
25- echo BUILD_FILE=git-crypt-${{ github.ref_name }}-darwin-${{ env.RUNNER_ARCH }} >> $GITHUB_ENV
26-
27- - name : Run integration tests for ${{ env.BUILD_FILE }}
28- run : |
2928 chmod +x ./tests/linux/basic-test.sh
3029 ./tests/linux/basic-test.sh
3130
32- - name : Determine artifacts name
33- id : artifacts-name
34- env :
35- IS_RELEASE : ${{ github.event_name == 'release' }}
31+ - name : Prepare Artifact
32+ id : prep_artifact
3633 run : |
37- if [ "$IS_RELEASE" = true ]; then
38- echo "artifacts-name=${{ env.BUILD_FILE }}" >> $GITHUB_ENV
39- else
40- echo "artifacts-name=${{ env.BUILD_FILE }}-dev" >> $GITHUB_ENV
34+ # Use runner.arch which resolves to 'x64' or 'arm64'
35+ FINAL_NAME="git-crypt-${{ github.ref_name }}-darwin-${{ runner.arch }}"
36+
37+ # Append '-dev' suffix for non-release builds (e.g., PRs)
38+ if [[ "${{ github.event_name }}" != 'release' ]]; then
39+ FINAL_NAME="${FINAL_NAME}-dev"
4140 fi
41+
42+ echo "Renaming binary to ${FINAL_NAME}"
43+ mv git-crypt "${FINAL_NAME}"
44+
45+ # Set the final name as an output for the next step
46+ echo "artifact_name=${FINAL_NAME}" >> "$GITHUB_OUTPUT"
4247
43- - name : Upload release artifact
48+ - name : Upload Artifact
4449 uses : actions/upload-artifact@v4
4550 with :
46- name : ${{ env.artifacts-name }}
47- path : git-crypt
51+ # Use the output from the previous step for both the artifact and path
52+ name : ${{ steps.prep_artifact.outputs.artifact_name }}
53+ path : ${{ steps.prep_artifact.outputs.artifact_name }}
4854
4955 upload :
5056 name : Upload Release Binary
5157 if : github.event_name == 'release'
5258 runs-on : ubuntu-latest
5359 needs : build
5460 permissions :
61+ # 'contents: write' is required to upload assets to the release
5562 contents : write
5663 steps :
57- - name : Download release artifacts
64+ - name : Download all release artifacts
5865 uses : actions/download-artifact@v4
5966
60- - name : Upload release assets
61- uses : AButler/upload-release-assets@v3
62- if : github.ref_type == 'tag'
67+ - name : Upload assets to GitHub release
68+ uses : AButler/upload-release-assets@v3.0
6369 with :
64- files : git-crypt-*-darwin-*
65- repo-token : ${{ secrets.GITHUB_TOKEN }}
70+ # The download action creates subdirectories for each artifact.
71+ # The '**/...' glob pattern searches recursively to find the binaries.
72+ files : ' **/git-crypt-*-darwin-*'
73+ repo-token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments