From 181c78eeeedfa2db2820c153dfe9c2793db36b36 Mon Sep 17 00:00:00 2001 From: badarsebard Date: Sun, 24 Oct 2021 19:59:23 -0400 Subject: [PATCH] Initial release --- .github/workflows/release.yaml | 55 ++++++++++++++++++++++++++++++++ .goreleaser.yaml | 58 ++++++++++++++++++++++++++++++++++ go.mod | 4 +-- go.sum | 2 ++ 4 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..e28ad79 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,55 @@ +# This GitHub action can publish assets for release when a tag is created. +# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). +# +# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your +# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` +# secret. If you would rather own your own GPG handling, please fork this action +# or use an alternative one for key handling. +# +# You will need to pass the `--batch` flag to `gpg` in your signing step +# in `goreleaser` to indicate this is being used in a non-interactive mode. +# +name: release +on: + push: + tags: + - 'v*' +jobs: + release: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2.3.4 + - + name: Unshallow + run: git fetch --prune --unshallow + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + - + name: Import GPG key + id: import_gpg + uses: hashicorp/ghaction-import-gpg@v2.1.0 + env: + # These secrets will need to be configured for the repository: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + PASSPHRASE: ${{ secrets.PASSPHRASE }} + - name: Add Manifest + run: | + tag=${GITHUB_REF#refs/*/} + version=${tag:1} + mkdir local + echo '{"version": 1,"metadata": {"protocol_versions": ["6.0"]}}' > local/terraform-provider-xsoar_${version}_manifest.json + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + # GitHub sets this automatically + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..8b32aef --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,58 @@ +# Visit https://goreleaser.com for documentation on how to customize this +# behavior. +before: + hooks: + # this is just an example and not a requirement for provider building/publishing + - go mod tidy +builds: + - env: + # goreleaser does not work with CGO, it could also complicate + # usage by users in CI/CD systems like Terraform Cloud where + # they are unable to install libraries. + - CGO_ENABLED=0 + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - -trimpath + ldflags: + - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' + goos: + - freebsd + - windows + - linux + - darwin + goarch: + - amd64 + - '386' + - arm + - arm64 + ignore: + - goos: darwin + goarch: '386' + binary: '{{ .ProjectName }}_v{{ .Version }}' +archives: + - format: zip + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' + algorithm: sha256 + extra_files: + - glob: "./local/*.json" +signs: + - artifacts: checksum + args: + # if you are using this in a GitHub action or some other automated pipeline, you + # need to pass the batch flag to indicate its not interactive. + - "--batch" + - "--local-user" + - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key + - "--output" + - "${signature}" + - "--detach-sign" + - "${artifact}" +release: +# If you want to manually examine the release before its live, uncomment this line: +# draft: true + extra_files: + - glob: "./local/*.json" +changelog: + skip: true \ No newline at end of file diff --git a/go.mod b/go.mod index 8b3f81e..e13a4b6 100644 --- a/go.mod +++ b/go.mod @@ -2,10 +2,8 @@ module terraform-provider-xsoar go 1.17 -replace github.com/badarsebard/xsoar-sdk-go/openapi => /home/jrauen/go/src/github.com/badarsebard/xsoar-sdk-go/openapi - require ( - github.com/badarsebard/xsoar-sdk-go/openapi v0.1.70 + github.com/badarsebard/xsoar-sdk-go/openapi v0.2.3 github.com/bramvdbogaerde/go-scp v1.1.0 github.com/hashicorp/terraform-plugin-framework v0.4.2 github.com/hashicorp/terraform-plugin-go v0.4.0 diff --git a/go.sum b/go.sum index 8ee2120..a3c9598 100644 --- a/go.sum +++ b/go.sum @@ -66,6 +66,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.25.3 h1:uM16hIw9BotjZKMZlX05SN2EFtaWfi/NonPKIARiBLQ= github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/badarsebard/xsoar-sdk-go/openapi v0.2.3 h1:F8f0jj0AQA5zjPZp/TxzYyZO/ysdxtJgZGjpuJF6beU= +github.com/badarsebard/xsoar-sdk-go/openapi v0.2.3/go.mod h1:ajTXUkkEZSq3Ia8hvMGd0E8G93gqwOz2D295d8gL0N4= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=