|
| 1 | +name: main |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - '**' |
| 6 | + tags-ignore: |
| 7 | + - '*' |
| 8 | +env: |
| 9 | + go-version: stable |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Build |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - name: Setup Go |
| 17 | + uses: actions/setup-go@v5 |
| 18 | + with: |
| 19 | + go-version: ${{ env.go-version }} |
| 20 | + - name: Build |
| 21 | + run: make build |
| 22 | + lint: |
| 23 | + name: Lint |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - uses: actions/setup-python@v5 |
| 28 | + - name: Setup Go |
| 29 | + uses: actions/setup-go@v5 |
| 30 | + with: |
| 31 | + go-version: ${{ env.go-version }} |
| 32 | + - name: Lint |
| 33 | + run: make lint |
| 34 | + - name: Lint |
| 35 | + run: make lint |
| 36 | + test: |
| 37 | + name: Test |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + - name: Setup Go |
| 42 | + uses: actions/setup-go@v5 |
| 43 | + with: |
| 44 | + go-version: ${{ env.go-version }} |
| 45 | + - name: Test |
| 46 | + run: make test |
| 47 | + check-goreleaser-config: |
| 48 | + name: Check goreleaser.yml |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + - name: Setup go |
| 53 | + uses: actions/setup-go@v5 |
| 54 | + with: |
| 55 | + go-version: ${{ env.go-version }} |
| 56 | + - uses: goreleaser/goreleaser-action@v5 |
| 57 | + with: |
| 58 | + version: latest |
| 59 | + args: check -f .goreleaser.yml |
| 60 | + dry-run: |
| 61 | + name: Dry-run release |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - name: Checkout |
| 65 | + uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + fetch-depth: 0 |
| 68 | + - uses: docker/setup-qemu-action@v3 |
| 69 | + - uses: docker/setup-buildx-action@v3 |
| 70 | + - uses: anchore/sbom-action/download-syft@v0.15.5 |
| 71 | + - name: Setup go |
| 72 | + uses: actions/setup-go@v5 |
| 73 | + with: |
| 74 | + go-version: ${{ env.go-version }} |
| 75 | + - name: Setup latest version tag |
| 76 | + run: | |
| 77 | + echo "GORELEASER_CURRENT_TAG=$(git describe --tags --abbrev=0 --match "v*" || echo v0.0.0)" >> $GITHUB_ENV |
| 78 | + - name: GoReleaser |
| 79 | + uses: goreleaser/goreleaser-action@v5 |
| 80 | + with: |
| 81 | + version: latest |
| 82 | + args: --snapshot --skip=sign,publish --clean |
| 83 | + - name: Test built containers |
| 84 | + run: make container-structure-test |
| 85 | + tag: |
| 86 | + name: Tag release |
| 87 | + if: github.ref == 'refs/heads/master' && github.event_name == 'push' |
| 88 | + needs: [build, lint, check-goreleaser-config, test, dry-run] |
| 89 | + runs-on: ubuntu-latest |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v4 |
| 92 | + with: |
| 93 | + token: ${{ secrets.PAT }} |
| 94 | + - name: Tag release |
| 95 | + run: | |
| 96 | + TAG="v$(cat VERSION)" |
| 97 | + git tag ${TAG} |
| 98 | + git push origin ${TAG} || true |
0 commit comments