Build and release Go Project #8
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
| # .github/workflows/release.yaml | ||
| name: Build and release Go Project | ||
| on: | ||
| release: | ||
| types: [created] | ||
| jobs: | ||
| release-linux-amd64: | ||
| name: release linux/amd64 | ||
| runs-on: ubuntu-latest | ||
| permissions: write-all | ||
| strategy: | ||
| matrix: | ||
| # List of GOOS and GOARCH pairs from `go tool dist list` | ||
| goosarch: | ||
| - 'linux/ppc64le' | ||
| - 'linux/amd64' | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v6 # Recommended action to set up Go environment | ||
| with: | ||
| go-version-file: 'go.mod' # Automatically detects the Go version from go.mod | ||
| - name: Get OS and arch info | ||
| run: | | ||
| GOOSARCH=${{matrix.goosarch}} | ||
| GOOS=${GOOSARCH%/*} | ||
| GOARCH=${GOOSARCH#*/} | ||
| REPO=${{github.repository}} | ||
| BINARY_NAME=${REPO#*/}-$GOOS-$GOARCH | ||
| echo "BINARY_NAME=$BINARY_NAME" >> $GITHUB_ENV | ||
| echo "GOOS=$GOOS" >> $GITHUB_ENV | ||
| echo "GOARCH=$GOARCH" >> $GITHUB_ENV | ||
| - name: Set version variable | ||
| run: echo "PROGRAM_VERSION="$(git describe --always --long --dirty) >> ${GITHUB_ENV} | ||
| - name: Set release variable | ||
| run: echo "PROGRAM_RELEASE="$(git describe --tags --abbrev=0) >> ${GITHUB_ENV} | ||
| - name: Build project | ||
| run: go build -ldflags="-X main.version=$(git describe --always --long --dirty) -X main.release=$(git describe --tags --abbrev=0)" -o "$BINARY_NAME" *.go | ||
| - name: Release binaries | ||
| uses: softprops/action-gh-release@v2 | ||
| # https://github.com/softprops/action-gh-release | ||
| with: | ||
| files: | | ||
| ${{ env.BINARY_NAME }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically provided secret | ||
| - name: Release scripts | ||
| uses: softprops/action-gh-release@v2 | ||
| # https://github.com/softprops/action-gh-release | ||
| if: ${{ env.GOARCH }} == 'amd64' | ||
|
Check warning on line 61 in .github/workflows/release.yml
|
||
| with: | ||
| files: | | ||
| scripts/create-cluster.sh | ||
| scripts/delete-cluster.sh | ||
| scripts/console.sh | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically provided secret | ||