Merge pull request #19 from Squix/feat/diff-command-git #31
This file contains hidden or 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 and Release | |
| on: | |
| # Run on tag pushes from main branch | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| # Manual trigger for testing | |
| workflow_dispatch: | |
| inputs: | |
| debug_enabled: | |
| description: 'Run with debug logging' | |
| required: false | |
| default: false | |
| type: boolean | |
| # Add release creationpermissions for the GITHUB_TOKEN | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| # Only run if tag is on main branch or manual trigger | |
| if: (github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')) || github.event_name == 'workflow_dispatch' | |
| runs-on: ${{ matrix.os }} | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: airtable-devops-windows.exe | |
| os_name: windows | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact_name: airtable-devops-linux-x64 | |
| os_name: linux | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| artifact_name: airtable-devops-linux-arm64 | |
| os_name: linux | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: airtable-devops-macos-x64 | |
| os_name: macos | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: airtable-devops-macos-arm64 | |
| os_name: macos | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version from version.ts | |
| id: get_version | |
| run: | | |
| VERSION=$(grep -o 'VERSION = "[^"]*"' version.ts | cut -d'"' -f2) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Setup Deno | |
| uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: v2.x | |
| - name: Build binary | |
| run: | | |
| deno compile --target ${{ matrix.target }} --allow-net --allow-env --allow-read --allow-write main.ts | |
| # Rename the binary based on target and version | |
| mv airtable-devops* "airtable-devops-${{ steps.get_version.outputs.version }}-${{ matrix.os_name }}-${{ matrix.target == 'x86_64-pc-windows-msvc' && 'x64' || matrix.target == 'x86_64-unknown-linux-gnu' && 'x64' || matrix.target == 'x86_64-apple-darwin' && 'x64' || matrix.target == 'aarch64-apple-darwin' && 'arm64' || 'arm64' }}" | |
| if [ "${{ matrix.target }}" = "x86_64-pc-windows-msvc" ]; then | |
| mv "airtable-devops-${{ steps.get_version.outputs.version }}-${{ matrix.os_name }}-x64" "airtable-devops-${{ steps.get_version.outputs.version }}-${{ matrix.os_name }}-x64.exe" | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: "airtable-devops-${{ steps.get_version.outputs.version }}-*" | |
| if-no-files-found: error | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| # Only create release when triggered by a tag on main or manual trigger | |
| if: (github.ref_type == 'tag' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./artifacts | |
| merge-multiple: true | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_type == 'tag' && github.ref_name || format('v{0}', needs.build.outputs.version) }} | |
| files: artifacts/* | |
| generate_release_notes: true | |
| draft: true | |
| prerelease: false |