Build plugin in bookworm container to match bifrost's dynamic image (#4) #17
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: | |
| branches: [main] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.26.1' | |
| - name: Download dependencies | |
| run: make deps | |
| - name: Run tests | |
| run: make test | |
| - name: Build plugin (Linux AMD64) | |
| run: | | |
| mkdir -p build | |
| docker run --rm \ | |
| --platform linux/amd64 \ | |
| -v "${{ github.workspace }}:/work" \ | |
| -w /work \ | |
| -e CGO_ENABLED=1 \ | |
| -e GOOS=linux \ | |
| -e GOARCH=amd64 \ | |
| golang:1.26.1-bookworm \ | |
| sh -c "apt-get update && apt-get install -y gcc && \ | |
| go build -buildmode=plugin -ldflags='-w -s' -trimpath -o build/encoding-format.so main.go" | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: encoding-format-linux-amd64 | |
| path: build/encoding-format.so | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: encoding-format-linux-amd64 | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: encoding-format.so | |
| generate_release_notes: true |