Build pkg. #8
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
name: Build Binaries | |
on: | |
push: | |
tags: | |
- '*' # Only build on tag pushes for releases | |
workflow_dispatch: # Allow manual triggering of the build | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
include: | |
- os: ubuntu-latest | |
binary_name: sqlwrite | |
- os: macos-latest | |
binary_name: sqlwrite-mac.pkg | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" ]]; then | |
sudo apt-get update | |
sudo apt-get install -y make curl libcurl4-openssl-dev | |
fi | |
- name: Build with Make | |
run: make | |
- name: Package as .pkg on macOS | |
if: matrix.os == 'macos-latest' | |
run: make pkg | |
- name: Upload Linux binary as artifact | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sqlwrite | |
path: sqlwrite | |
- name: Upload macOS pkg as artifact | |
if: matrix.os == 'macos-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sqlwrite-mac.pkg | |
path: sqlwrite-mac.pkg | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download Linux artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: sqlwrite | |
path: . | |
- name: Download macOS pkg artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: sqlwrite-mac.pkg | |
path: . | |
- name: Delete existing release (if any) | |
run: | | |
gh release delete "${{ github.ref_name }}" -y || echo "No existing release to delete" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
- name: Upload Linux binary to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./sqlwrite | |
asset_name: sqlwrite | |
asset_content_type: application/octet-stream | |
- name: Upload macOS pkg to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./sqlwrite-mac.pkg | |
asset_name: sqlwrite-mac.pkg | |
asset_content_type: application/octet-stream |