name: Build and Release on: workflow_dispatch: push: paths: - 'VERSION' permissions: contents: write jobs: version: runs-on: ubuntu-latest outputs: version: ${{ steps.version.outputs.version }} tag: ${{ steps.version.outputs.tag }} steps: - name: Checkout uses: actions/checkout@v4 - name: Read version id: version shell: bash run: | version="$(tr -d '[:space:]' < VERSION)" echo "version=${version}" >> "${GITHUB_OUTPUT}" echo "tag=v${version}" >> "${GITHUB_OUTPUT}" build: needs: version runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - goos: linux goarch: amd64 - goos: linux goarch: arm64 - goos: windows goarch: amd64 - goos: darwin goarch: amd64 - goos: freebsd goarch: amd64 steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: go.mod cache: true - name: Build binary env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} CGO_ENABLED: 0 VERSION: ${{ needs.version.outputs.version }} shell: bash run: | artifact="aurora-${VERSION}-${GOOS}-${GOARCH}" mkdir -p "${artifact}" output="aurora" if [ "${GOOS}" = "windows" ]; then output="aurora.exe" fi go build -trimpath -ldflags="-s -w" -o "${artifact}/${output}" . tar -czf "${artifact}.tar.gz" "${artifact}" - name: Upload artifact uses: actions/upload-artifact@v4 with: name: aurora-${{ needs.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }} path: aurora-${{ needs.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz if-no-files-found: error release: needs: - version - build runs-on: ubuntu-latest steps: - name: Download artifacts uses: actions/download-artifact@v4 with: path: dist merge-multiple: true - name: Create release uses: softprops/action-gh-release@v2 with: tag_name: ${{ needs.version.outputs.tag }} name: ${{ needs.version.outputs.tag }} files: dist/*.tar.gz