diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7e5ba8d..dc215d7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,4 +1,4 @@ -name: Auto Build GoStack Nightly Multi-OS +name: Auto Build GoStack Nightly on: push: @@ -8,24 +8,8 @@ permissions: contents: write jobs: - build: - name: Build for ${{ matrix.os }} + build-and-release: runs-on: ubuntu-latest - strategy: - matrix: - include: - - os: linux - goos: linux - goarch: amd64 - ext: "" - - os: windows - goos: windows - goarch: amd64 - ext: ".exe" - - os: macos - goos: darwin - goarch: amd64 - ext: "" steps: - name: Checkout repository uses: actions/checkout@v4 @@ -43,51 +27,30 @@ jobs: BUILD_NUM=$(git rev-list --count HEAD) echo "build_num=$BUILD_NUM" >> $GITHUB_OUTPUT - - name: Build Executable for ${{ matrix.os }} - env: - GOOS: ${{ matrix.goos }} - GOARCH: ${{ matrix.goarch }} + - name: Build for Linux run: | BUILD_NUM=${{ steps.buildnum.outputs.build_num }} - go build -o gostack-${{ matrix.os }}-$BUILD_NUM${{ matrix.ext }} . - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: binary-${{ matrix.os }} - path: gostack-${{ matrix.os }}-*${{ matrix.ext }} - - release: - needs: build - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - fetch-depth: 0 + GOOS=linux GOARCH=amd64 go build -o gostack-linux-$BUILD_NUM . - - name: Get Build Number - id: buildnum + - name: Build for Windows run: | - BUILD_NUM=$(git rev-list --count HEAD) - echo "build_num=$BUILD_NUM" >> $GITHUB_OUTPUT - - - name: Download All Artifacts - uses: actions/download-artifact@v4 - with: - path: all-binaries + BUILD_NUM=${{ steps.buildnum.outputs.build_num }} + GOOS=windows GOARCH=amd64 go build -o gostack-windows-$BUILD_NUM.exe . - - name: Prepare Binaries Directory + - name: Build for macOS run: | - mkdir -p final-release - cp all-binaries/binary-*/* final-release/ - ls -la final-release/ + BUILD_NUM=${{ steps.buildnum.outputs.build_num }} + GOOS=darwin GOARCH=amd64 go build -o gostack-macos-$BUILD_NUM . - - name: Create Single Nightly Release + - name: Create Nightly Release and Upload All uses: softprops/action-gh-release@v2 with: tag_name: nightly-${{ steps.buildnum.outputs.build_num }} name: "Nightly Build #${{ steps.buildnum.outputs.build_num }}" prerelease: true - files: final-release/* + files: | + gostack-linux-${{ steps.buildnum.outputs.build_num }} + gostack-windows-${{ steps.buildnum.outputs.build_num }}.exe + gostack-macos-${{ steps.buildnum.outputs.build_num }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}