|
| 1 | +name: Source Plugin Tailscale Workflow |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - "plugins/source/tailscale/**" |
| 7 | + - ".github/workflows/source_tailscale.yml" |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + paths: |
| 12 | + - "plugins/source/tailscale/**" |
| 13 | + - ".github/workflows/source_tailscale.yml" |
| 14 | + |
| 15 | +jobs: |
| 16 | + plugins-source-tailscale: |
| 17 | + timeout-minutes: 30 |
| 18 | + name: "plugins/source/tailscale" |
| 19 | + runs-on: ubuntu-latest |
| 20 | + defaults: |
| 21 | + run: |
| 22 | + working-directory: ./plugins/source/tailscale |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + with: |
| 26 | + fetch-depth: 2 |
| 27 | + - name: Set up Go 1.x |
| 28 | + uses: actions/setup-go@v3 |
| 29 | + with: |
| 30 | + go-version-file: plugins/source/tailscale/go.mod |
| 31 | + cache: true |
| 32 | + cache-dependency-path: plugins/source/tailscale/go.sum |
| 33 | + - name: golangci-lint |
| 34 | + uses: golangci/golangci-lint-action@v3 |
| 35 | + with: |
| 36 | + version: v1.50.1 |
| 37 | + working-directory: plugins/source/tailscale |
| 38 | + args: "--config ../../.golangci.yml" |
| 39 | + - name: Get dependencies |
| 40 | + run: go get -t -d ./... |
| 41 | + - name: Build |
| 42 | + run: go build . |
| 43 | + - name: Test |
| 44 | + run: make test |
| 45 | + - name: gen |
| 46 | + if: github.event_name == 'pull_request' |
| 47 | + run: make gen |
| 48 | + - name: Cleanup after build |
| 49 | + run: rm ./tailscale |
| 50 | + - name: Fail if generation updated files |
| 51 | + if: github.event_name == 'pull_request' |
| 52 | + run: test "$(git status -s | wc -l)" -eq 0 |
| 53 | + validate-release: |
| 54 | + timeout-minutes: 30 |
| 55 | + runs-on: ubuntu-latest |
| 56 | + env: |
| 57 | + CGO_ENABLED: 0 |
| 58 | + steps: |
| 59 | + - name: Checkout |
| 60 | + if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' |
| 61 | + uses: actions/checkout@v3 |
| 62 | + - uses: actions/cache@v3 |
| 63 | + if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' |
| 64 | + with: |
| 65 | + path: | |
| 66 | + ~/.cache/go-build |
| 67 | + ~/go/pkg/mod |
| 68 | + key: ${{ runner.os }}-go-1.19.3-release-cache-${{ hashFiles('plugins/source/tailscale/go.sum') }} |
| 69 | + restore-keys: | |
| 70 | + ${{ runner.os }}-go-1.19.3-release-cache-plugins-source-tailscale |
| 71 | + - name: Set up Go |
| 72 | + if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' |
| 73 | + uses: actions/setup-go@v3 |
| 74 | + with: |
| 75 | + go-version-file: plugins/source/tailscale/go.mod |
| 76 | + - name: Install GoReleaser |
| 77 | + if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' |
| 78 | + uses: goreleaser/goreleaser-action@v3 |
| 79 | + with: |
| 80 | + distribution: goreleaser-pro |
| 81 | + version: latest |
| 82 | + install-only: true |
| 83 | + - name: Run GoReleaser Dry-Run |
| 84 | + if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' |
| 85 | + run: goreleaser release --snapshot --rm-dist --skip-validate --skip-publish --skip-sign -f ./plugins/source/tailscale/.goreleaser.yaml |
| 86 | + env: |
| 87 | + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
0 commit comments