Skip to content

Build and Release

Build and Release #13

Workflow file for this run

name: Build and Release
on:
workflow_dispatch:
inputs:
bump:
description: Type of version bump
required: true
default: patch
type: choice
options:
- patch
- minor
- major
env:
TOOL_NAME: csv-parse
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
jobs:
build:
name: 🛠️ Build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: linuxX64
- os: macos-14-large
target: macosX64
- os: macos-14
target: macosArm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@v4
- name: Build native binary
run: ./gradlew linkReleaseExecutable${{ matrix.target }}
- name: Package native binary
run: |
mkdir -p artifacts
strip -x build/bin/${{ matrix.target }}/releaseExecutable/${{ env.TOOL_NAME }}.kexe
cp build/bin/${{ matrix.target }}/releaseExecutable/${{ env.TOOL_NAME }}.kexe artifacts/${{ env.TOOL_NAME }}
zip -j artifacts/${{ env.TOOL_NAME }}-${{ matrix.target }}.zip artifacts/${{ env.TOOL_NAME }}
- name: Upload artifact for ${{ matrix.target }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.TOOL_NAME}}-${{ matrix.target }}.zip
path: artifacts/${{ env.TOOL_NAME }}-${{ matrix.target }}.zip
release:
name: 🚀 Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Increment version
run: ./scripts/increment-version.sh ${{ github.event.inputs.bump }}
- name: Commit and tag changes
run: |
git config --global user.name "alpoi[bot]"
git config --global user.email "me@angus.buzz"
git add .
git commit -m "🚀 $NEW_VERSION"
git push origin main
git tag -a "v$NEW_VERSION" -m "🚀 $NEW_VERSION"
git push origin "v$NEW_VERSION"
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create release with artifacts
uses: ncipollo/release-action@v1
with:
tag: v${{ env.NEW_VERSION }}
name: Release v${{ env.NEW_VERSION }}
artifacts: artifacts/*.zip