diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 823fd11..6c2e30b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -167,9 +167,35 @@ jobs: # reporter: java-junit # fail-on-error: 'true' - build: + release: runs-on: ubuntu-latest -# needs: [ tests-combine-summaries ] + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: '0' + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v8 + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.15 + with: + versionSpec: 5.x + - id: determine_version + name: Determine Version + uses: gittools/actions/gitversion/execute@v0.9.15 + with: + additionalArguments: /overrideconfig mode=Mainline + - name: Tag Release + uses: mathieudutour/github-tag-action@v6.1 + continue-on-error: true + with: + custom_tag: ${{ steps.determine_version.outputs.semVer }} + github_token: ${{ secrets.GITHUB_TOKEN }} + + build-linux: + runs-on: ubuntu-latest + needs: [ release ] steps: - name: Checkout code uses: actions/checkout@v3 @@ -238,16 +264,55 @@ jobs: # GOOS: darwin # GOARCH: arm64 # CGO_ENABLED: 1 - - name: Tag Release - uses: mathieudutour/github-tag-action@v6.1 + - name: Upload Release Assets + uses: softprops/action-gh-release@v1 continue-on-error: true with: - custom_tag: ${{ steps.determine_version.outputs.semVer }} - github_token: ${{ secrets.GITHUB_TOKEN }} + tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }} + files: | + octoterrawiz_linux_amd64 + + build-windows: + runs-on: windows-latest + needs: [ release ] + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: '0' + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v8 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22.5' + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.15 + with: + versionSpec: 5.x + - id: determine_version + name: Determine Version + uses: gittools/actions/gitversion/execute@v0.9.15 + with: + additionalArguments: /overrideconfig mode=Mainline + - name: Install Dependencies + run: go get ./... + shell: bash + - run: go build -ldflags="-X 'main.Version=${{ steps.determine_version.outputs.semVer }}'" -o octoterrawiz_linux_amd64 octoterrawiz.go + env: + GOOS: linux + GOARCH: amd64 + CGO_ENABLED: 1 + - run: go build -ldflags="-X 'main.Version=${{ steps.determine_version.outputs.semVer }}'" -o octoterrawiza_windows_amd64.exe octoterrawiz.go + env: + GOOS: windows + GOARCH: amd64 + CGO_ENABLED: 1 - name: Upload Release Assets uses: softprops/action-gh-release@v1 continue-on-error: true with: tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }} files: | - octoterrawiz_linux_amd64 \ No newline at end of file + octoterrawiza_windows_amd64.exe \ No newline at end of file