diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index f6233e0..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: build -on: - push: - branches: - - master - pull_request: - -jobs: - test: - name: Test - runs-on: ubuntu-latest - steps: - - name: Set up Go 1.12 - uses: actions/setup-go@v1 - with: - go-version: 1.12 - id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v1 - - uses: actions/cache@v1 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Run tests - run: make test - - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Set up Go 1.12 - uses: actions/setup-go@v1 - with: - go-version: 1.12 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v1 - - - name: Build binary for current OS/ARCH - run: make build diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml deleted file mode 100644 index 23e306e..0000000 --- a/.github/workflows/prerelease.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: prerelease - -on: - push: - tags: - - "v*.*.*" - -jobs: - prerelease: - name: Pre-Release - runs-on: ubuntu-latest - steps: - - name: Set up Go 1.12 - uses: actions/setup-go@v1 - with: - go-version: 1.12 - id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v1 - - uses: actions/cache@v1 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Build binaries for all OS/ARCH platforms - run: | - export PATH=$PATH:$(go env GOPATH)/bin - make gox build-all - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: bin/terraform-provider-confluentcloud-v* - draft: false - prerelease: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f59462e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: release + +on: + push: + tags: + - 'v*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.13.x + - uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + key: ${{ secrets.YOUR_PRIVATE_KEY }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml new file mode 100644 index 0000000..8bb029c --- /dev/null +++ b/.github/workflows/snapshot.yml @@ -0,0 +1,31 @@ +name: Build Snapshots + +on: + push: + branches: + - '**' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.13.x + - uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --snapshot --rm-dist + key: ${{ secrets.YOUR_PRIVATE_KEY }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b937e73 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,29 @@ +name: test + +on: + push: + branches: + - '**' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.13.x + - run: | + export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14 + go install github.com/jstemmer/go-junit-report + trap "go-junit-report < go-test.out > go-test-report.xml" EXIT + make test | tee go-test.out + - name: Upload test results + uses: actions/upload-artifact@v1 + with: + name: acc-test-results.xml + path: go-test-report.xml + # Use always() to always run this step to publish test results when there are test failures + if: always() diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..adf66a5 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,19 @@ +builds: + - binary: "{{ .ProjectName }}_v{{ .Version }}" + env: + - CGO_ENABLED=0 + goos: + - darwin + - linux + - windows + goarch: + - amd64 + - 386 + - arm + - arm64 + goarm: + - 7 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next"