fix(install): advertise native hooks in install.sh; version-aware yay… #39
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: ci | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| pull_request: | |
| jobs: | |
| # Runs on every push and PR. | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # full history + tags so `git describe` works | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| - run: go vet ./... | |
| - run: go build ./... | |
| - run: go test ./... | |
| # Builds release artifacts. UPX-packs amd64 only (arm64 UPX support is less | |
| # reliable, so that artifact ships uncompressed). On a v* tag it also creates | |
| # the GitHub Release; otherwise artifacts are just uploaded for inspection. | |
| release: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # required to create the Release and upload assets | |
| strategy: | |
| matrix: | |
| goarch: [amd64, arm64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # tags needed for version stamping | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| - name: derive version | |
| id: ver | |
| run: | | |
| VERSION="$(git describe --tags --always --dirty 2>/dev/null || echo dev)" | |
| COMMIT="$(git rev-parse --short=12 HEAD 2>/dev/null || true)" | |
| DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "commit=$COMMIT" >> "$GITHUB_OUTPUT" | |
| echo "date=$DATE" >> "$GITHUB_OUTPUT" | |
| echo "Building $VERSION ($COMMIT)" | |
| - name: build static binary (version-stamped) | |
| env: | |
| CGO_ENABLED: '0' | |
| GOOS: linux | |
| GOARCH: ${{ matrix.goarch }} | |
| PKG: github.com/manticore-projects/aurscan/internal/version | |
| run: | | |
| go build -trimpath \ | |
| -ldflags="-s -w \ | |
| -X ${PKG}.Version=${{ steps.ver.outputs.version }} \ | |
| -X ${PKG}.Commit=${{ steps.ver.outputs.commit }} \ | |
| -X ${PKG}.Date=${{ steps.ver.outputs.date }}" \ | |
| -o aurscan-linux-${{ matrix.goarch }} ./cmd/aurscan | |
| - name: verify version stamp (amd64) | |
| if: matrix.goarch == 'amd64' | |
| run: ./aurscan-linux-amd64 --version | |
| - name: compress with upx (amd64 only) | |
| if: matrix.goarch == 'amd64' | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y upx-ucl | |
| upx --best --lzma aurscan-linux-${{ matrix.goarch }} | |
| upx -t aurscan-linux-${{ matrix.goarch }} | |
| - name: upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: aurscan-linux-${{ matrix.goarch }} | |
| path: aurscan-linux-${{ matrix.goarch }} | |
| - name: attach to release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: aurscan-linux-${{ matrix.goarch }} |