v0.3.2 #20
Workflow file for this run
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: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version tag (e.g., v1.0.0)" | |
| required: false | |
| default: "dev" | |
| permissions: | |
| contents: write | |
| packages: write | |
| actions: write | |
| jobs: | |
| build-macos: | |
| name: Build macOS | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| goarch: amd64 | |
| - arch: arm64 | |
| goarch: arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.25" | |
| - name: Get version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" == "release" ]; then | |
| echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build binary | |
| env: | |
| CGO_ENABLED: 1 | |
| GOOS: darwin | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| go build -o axidev-corrige-darwin-${{ matrix.arch }} . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: axidev-corrige-darwin-${{ matrix.arch }} | |
| path: axidev-corrige-darwin-${{ matrix.arch }} | |
| build-linux: | |
| name: Build Linux | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| goarch: amd64 | |
| cc: gcc | |
| runs-on: ubuntu-latest | |
| - arch: arm64 | |
| goarch: arm64 | |
| cc: aarch64-linux-gnu-gcc | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.25" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| LIBS=( | |
| pkg-config | |
| libgl1-mesa-dev | |
| libgles2-mesa-dev | |
| libegl1-mesa-dev | |
| xorg-dev | |
| libx11-dev | |
| libx11-xcb-dev | |
| libxcursor-dev | |
| libxrandr-dev | |
| libxinerama-dev | |
| libxi-dev | |
| libxkbcommon-dev | |
| libxkbcommon-x11-dev | |
| libxxf86vm-dev | |
| libwayland-dev | |
| libffi-dev | |
| libvulkan-dev | |
| libudev-dev | |
| libinput-dev | |
| libstdc++-13-dev | |
| ) | |
| sudo apt-get install -y gcc "${LIBS[@]}" | |
| # Install cross-compilation toolchain and ARM packages | |
| if [ "${{ matrix.arch }}" == "arm64" ]; then | |
| sudo dpkg --add-architecture arm64 | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| gcc-aarch64-linux-gnu \ | |
| g++-aarch64-linux-gnu | |
| sudo apt-get install -y "${LIBS[@]/%/:arm64}" | |
| fi | |
| - name: Get version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" == "release" ]; then | |
| echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build binary | |
| env: | |
| CGO_ENABLED: 1 | |
| GOOS: linux | |
| GOARCH: ${{ matrix.goarch }} | |
| CC: ${{ matrix.cc }} | |
| run: | | |
| go build -o axidev-corrige-linux-${{ matrix.arch }} . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: axidev-corrige-linux-${{ matrix.arch }} | |
| path: axidev-corrige-linux-${{ matrix.arch }} | |
| build-windows: | |
| name: Build Windows | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| goarch: amd64 | |
| - arch: arm64 | |
| goarch: arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.25" | |
| - name: Get version | |
| id: version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" == "release" ]; then | |
| echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up LLVM-MinGW | |
| shell: bash | |
| run: | | |
| VERSION="20240619" | |
| URL="https://github.com/mstorsjo/llvm-mingw/releases/download/${VERSION}/llvm-mingw-${VERSION}-ucrt-x86_64.zip" | |
| curl -L -o llvm-mingw.zip "$URL" | |
| 7z x llvm-mingw.zip -y > /dev/null | |
| echo "${{ github.workspace }}/llvm-mingw-${VERSION}-ucrt-x86_64/bin" >> $GITHUB_PATH | |
| if [ "${{ matrix.arch }}" = "arm64" ]; then | |
| echo "CC=aarch64-w64-mingw32-clang" >> $GITHUB_ENV | |
| echo "CXX=aarch64-w64-mingw32-clang++" >> $GITHUB_ENV | |
| else | |
| echo "CC=x86_64-w64-mingw32-clang" >> $GITHUB_ENV | |
| echo "CXX=x86_64-w64-mingw32-clang++" >> $GITHUB_ENV | |
| fi | |
| - name: Build binary with LLVM-MinGW | |
| shell: bash | |
| env: | |
| CGO_ENABLED: 1 | |
| GOOS: windows | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| go build -o axidev-corrige-windows-${{ matrix.arch }}.exe . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: axidev-corrige-windows-${{ matrix.arch }} | |
| path: axidev-corrige-windows-${{ matrix.arch }}.exe | |
| publish-release: | |
| name: Publish to Release | |
| runs-on: ubuntu-latest | |
| needs: [build-macos, build-linux, build-windows] | |
| if: github.event_name == 'release' | |
| steps: | |
| - name: Download darwin-amd64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: axidev-corrige-darwin-amd64 | |
| path: ./artifacts | |
| - name: Download darwin-arm64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: axidev-corrige-darwin-arm64 | |
| path: ./artifacts | |
| - name: Download linux-amd64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: axidev-corrige-linux-amd64 | |
| path: ./artifacts | |
| - name: Download linux-arm64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: axidev-corrige-linux-arm64 | |
| path: ./artifacts | |
| - name: Download windows-amd64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: axidev-corrige-windows-amd64 | |
| path: ./artifacts | |
| - name: Download windows-arm64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: axidev-corrige-windows-arm64 | |
| path: ./artifacts | |
| - name: Upload darwin-amd64 to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./artifacts/axidev-corrige-darwin-amd64 | |
| asset_name: axidev-corrige-darwin-amd64 | |
| asset_content_type: application/octet-stream | |
| - name: Upload darwin-arm64 to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./artifacts/axidev-corrige-darwin-arm64 | |
| asset_name: axidev-corrige-darwin-arm64 | |
| asset_content_type: application/octet-stream | |
| - name: Upload linux-amd64 to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./artifacts/axidev-corrige-linux-amd64 | |
| asset_name: axidev-corrige-linux-amd64 | |
| asset_content_type: application/octet-stream | |
| - name: Upload linux-arm64 to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./artifacts/axidev-corrige-linux-arm64 | |
| asset_name: axidev-corrige-linux-arm64 | |
| asset_content_type: application/octet-stream | |
| - name: Upload windows-amd64 to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./artifacts/axidev-corrige-windows-amd64.exe | |
| asset_name: axidev-corrige-windows-amd64.exe | |
| asset_content_type: application/octet-stream | |
| - name: Upload windows-arm64 to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./artifacts/axidev-corrige-windows-arm64.exe | |
| asset_name: axidev-corrige-windows-arm64.exe | |
| asset_content_type: application/octet-stream |