Fixed an error with github actions #25
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: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-executables: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag_name: ${{ github.ref_name }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.21' | |
| - name: Build binaries | |
| env: | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| run: | | |
| GOOS=linux GOARCH=amd64 go build -ldflags="-X github.com/MRQ67/stackmatch-cli/pkg/config.SupabaseURL=$SUPABASE_URL -X github.com/MRQ67/stackmatch-cli/pkg/config.SupabaseAPIKey=$SUPABASE_ANON_KEY" -o stackmatch-linux-amd64 . | |
| GOOS=darwin GOARCH=amd64 go build -ldflags="-X github.com/MRQ67/stackmatch-cli/pkg/config.SupabaseURL=$SUPABASE_URL -X github.com/MRQ67/stackmatch-cli/pkg/config.SupabaseAPIKey=$SUPABASE_ANON_KEY" -o stackmatch-darwin-amd64 . | |
| GOOS=darwin GOARCH=arm64 go build -ldflags="-X github.com/MRQ67/stackmatch-cli/pkg/config.SupabaseURL=$SUPABASE_URL -X github.com/MRQ67/stackmatch-cli/pkg/config.SupabaseAPIKey=$SUPABASE_ANON_KEY" -o stackmatch-darwin-arm64 . | |
| - name: Upload non-Windows artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: non-windows-build-artifacts | |
| path: | | |
| stackmatch-linux-amd64 | |
| stackmatch-darwin-amd64 | |
| stackmatch-darwin-arm64 | |
| build-msi: | |
| runs-on: windows-latest | |
| needs: build-executables | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.21' | |
| - name: Build Windows executable | |
| env: | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| run: go build -ldflags="-X github.com/MRQ67/stackmatch-cli/pkg/config.SupabaseURL=$SUPABASE_URL -X github.com/MRQ6g/stackmatch-cli/pkg/config.SupabaseAPIKey=$SUPABASE_ANON_KEY" -o stackmatch.exe . | |
| - name: Install WiX Toolset | |
| run: choco install wixtoolset -y | |
| - name: Add WiX to PATH | |
| run: echo "$((Get-Item (Get-Command candle.exe).Source).Directory.FullName)" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Generate GUIDs and update WXS file | |
| shell: pwsh | |
| run: | | |
| $upgradeCode = New-Guid | |
| $componentGuid = New-Guid | |
| (Get-Content installer/installer.wxs).Replace('PUT-UPGRADE-CODE-GUID-HERE', $upgradeCode) | Set-Content installer/installer.wxs | |
| (Get-Content installer/installer.wxs).Replace('PUT-COMPONENT-GUID-HERE', $componentGuid) | Set-Content installer/installer.wxs | |
| echo "Updated WXS file with new GUIDs." | |
| - name: Build MSI installer | |
| run: | | |
| candle.exe -dSourceDir=. installer/installer.wxs -o installer.wixobj | |
| light.exe -out stackmatch-${{ needs.build-executables.outputs.tag_name }}.msi installer.wixobj | |
| shell: cmd | |
| - name: Upload MSI artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build-artifacts | |
| path: stackmatch-*.msi | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [build-executables, build-msi] | |
| steps: | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true # This merges artifacts into a single directory | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: dist/* | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |