fix(ci): remove gosimple linter (merged into staticcheck in golangci-… #3
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| release: | |
| name: Build and Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| - name: Set release variables | |
| id: vars | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| VERSION="${TAG#v}" | |
| COMMIT="$(git rev-parse --short HEAD)" | |
| DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "commit=${COMMIT}" >> "$GITHUB_OUTPUT" | |
| echo "date=${DATE}" >> "$GITHUB_OUTPUT" | |
| - name: Build binaries | |
| env: | |
| CGO_ENABLED: '0' | |
| VERSION: ${{ steps.vars.outputs.version }} | |
| COMMIT: ${{ steps.vars.outputs.commit }} | |
| DATE: ${{ steps.vars.outputs.date }} | |
| run: | | |
| LDFLAGS="-s -w" | |
| LDFLAGS="${LDFLAGS} -X github.com/dvflw/mantle/internal/version.Version=${VERSION}" | |
| LDFLAGS="${LDFLAGS} -X github.com/dvflw/mantle/internal/version.Commit=${COMMIT}" | |
| LDFLAGS="${LDFLAGS} -X github.com/dvflw/mantle/internal/version.Date=${DATE}" | |
| platforms=( | |
| "linux/amd64" | |
| "linux/arm64" | |
| "darwin/amd64" | |
| "darwin/arm64" | |
| ) | |
| mkdir -p dist | |
| for platform in "${platforms[@]}"; do | |
| IFS='/' read -r os arch <<< "${platform}" | |
| output="mantle-${os}-${arch}" | |
| echo "Building ${output}..." | |
| GOOS="${os}" GOARCH="${arch}" go build \ | |
| -ldflags "${LDFLAGS}" \ | |
| -o "dist/${output}" \ | |
| ./cmd/mantle/ | |
| done | |
| - name: Create tarballs and checksums | |
| run: | | |
| cd dist | |
| for binary in mantle-*; do | |
| tar czf "${binary}.tar.gz" "${binary}" | |
| rm "${binary}" | |
| done | |
| sha256sum *.tar.gz > checksums.txt | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ steps.vars.outputs.tag }} | |
| run: | | |
| gh release create "${TAG}" \ | |
| --title "${TAG}" \ | |
| --generate-notes \ | |
| dist/*.tar.gz \ | |
| dist/checksums.txt | |
| docker: | |
| name: Docker Image | |
| runs-on: ubuntu-latest | |
| needs: release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set release variables | |
| id: vars | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| VERSION="${TAG#v}" | |
| COMMIT="$(git rev-parse --short HEAD)" | |
| DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "commit=${COMMIT}" >> "$GITHUB_OUTPUT" | |
| echo "date=${DATE}" >> "$GITHUB_OUTPUT" | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/dvflw/mantle | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| VERSION=${{ steps.vars.outputs.version }} | |
| COMMIT=${{ steps.vars.outputs.commit }} | |
| DATE=${{ steps.vars.outputs.date }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@0.28.0 | |
| with: | |
| image-ref: ghcr.io/dvflw/mantle:${{ steps.vars.outputs.version }} | |
| format: table | |
| exit-code: '1' | |
| severity: CRITICAL,HIGH |