Build and Test Release Binary (Linux) #46
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`); |