From 0754030d0f34b74552c7ee54f92fbc42136d9057 Mon Sep 17 00:00:00 2001
From: sbailey <1661003+spbsoluble@users.noreply.github.com>
Date: Thu, 17 Aug 2023 09:52:24 -0700
Subject: [PATCH] feat(ci): Adding CI to build different architectures of the
 plugin.

---
 .github/dependabot.yml                        |  12 +++
 .github/images/kf_logo.png                    | Bin 0 -> 3602 bytes
 .../workflows/keyfactor-starter-workflow.yml  |  43 +++++++++
 .github/workflows/release.yml                 |  43 +++++++++
 .goreleaser.yml                               |  86 ++++++++++++++++++
 5 files changed, 184 insertions(+)
 create mode 100644 .github/dependabot.yml
 create mode 100644 .github/images/kf_logo.png
 create mode 100644 .github/workflows/keyfactor-starter-workflow.yml
 create mode 100644 .github/workflows/release.yml
 create mode 100644 .goreleaser.yml

diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..fa3ed22
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,12 @@
+# See GitHub's documentation for more information on this file:
+# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
+version: 2
+updates:
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      interval: "daily"
+  - package-ecosystem: "gomod"
+    directory: "/"
+    schedule:
+      interval: "daily"
\ No newline at end of file
diff --git a/.github/images/kf_logo.png b/.github/images/kf_logo.png
new file mode 100644
index 0000000000000000000000000000000000000000..027e15ead76cb673ad0772596a804258e601476d
GIT binary patch
literal 3602
zcmX|^cRUpSAICXoCtNbl-YbWk3mHdt4jK8{B;yVpiIdI@QAU|(UnR3BPK3<NY!{Nf
zj&k;1{jPt0kI&=vc|AX$&+GAd|NV+LH#J~k0y9xjQLz{q>RM2InIa7aI?8TQSYbsm
z>HrG^9jb}}zBS50*Zn^u4+MfrhQbU~)X$Jqz<&{nz!XtY(cr16Xedto?+y?6|LZcI
z=KrkmFDRK3U``o|HPY3#3Z^FKhJLiRzS@$E2*0m`f{Kd37TaG6y$0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<Pmf#aBSIj>hNh=U-{3H0pf0Bl6%-bv3WJKDxC!&8v7
z6k{<rP^?nn^A+Z`m;|Feq-ijXD^TrWzVKI%GVhcIh0!zRx-nUGU^Th|nA+)?h)_yZ
z7~9*SUHbEiQW5_6Tes(;vMJ;patzqnH>8w={kk$&Q)L8&l)qxBk3$OKY`q~4KNO0y
zizt-s)D(f$u%Pr7jS3Xb5@AUpguFAnNkEz{x=O%Cxv#Y79~EWF3ppoq90?j0mW7nJ
Sy(#(E$Bgt$bt`mSqW%ZgDACCP

literal 0
HcmV?d00001

diff --git a/.github/workflows/keyfactor-starter-workflow.yml b/.github/workflows/keyfactor-starter-workflow.yml
new file mode 100644
index 0000000..7e58879
--- /dev/null
+++ b/.github/workflows/keyfactor-starter-workflow.yml
@@ -0,0 +1,43 @@
+name: Starter Workflow
+on: workflow_dispatch
+
+jobs:
+  catalog-update-check:
+    runs-on: windows-latest
+    outputs:
+      upd_cat: ${{ steps.read-json.outputs.prop }}
+    steps:
+      - uses: actions/checkout@v3
+      - name: Read json
+        id: read-json
+        shell: pwsh
+        run: |
+          $json = Get-Content integration-manifest.json | ConvertFrom-Json
+          echo "::set-output name=prop::$(echo $json.update_catalog)"
+
+  #call-create-github-release-workflow:
+  #  uses: Keyfactor/actions/.github/workflows/github-release.yml@main
+
+  #call-dotnet-build-and-release-workflow:
+  #  needs: [call-create-github-release-workflow]
+  #  uses: Keyfactor/actions/.github/workflows/dotnet-build-and-release.yml@main
+  #  with:
+  #    release_version: ${{ needs.call-create-github-release-workflow.outputs.release_version }}
+  #    release_url: ${{ needs.call-create-github-release-workflow.outputs.release_url }}
+  #    release_dir: SslStoreCaProxy/bin/Release
+  #  secrets: 
+  #    token: ${{ secrets.PRIVATE_PACKAGE_ACCESS }}
+
+  call-generate-readme-workflow:
+    if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
+    uses: Keyfactor/actions/.github/workflows/generate-readme.yml@main
+    secrets:
+      token: ${{ secrets.APPROVE_README_PUSH }}
+
+  call-update-catalog-workflow:
+    needs: catalog-update-check
+    if: needs.catalog-update-check.outputs.upd_cat == 'True' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
+    uses: Keyfactor/actions/.github/workflows/update-catalog.yml@main
+    secrets: 
+      token: ${{ secrets.SDK_SYNC_PAT }}
+ 
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..7c4987a
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,43 @@
+# Terraform Provider release workflow.
+name: Release
+
+# This GitHub action creates a release when a tag that matches the pattern
+# "v*" (e.g. v0.1.0) is created.
+on:
+  push:
+    tags:
+      - 'v*'
+
+# Releases need permissions to read and write the repository contents.
+# GitHub considers creating releases and uploading assets as writing contents.
+permissions:
+  contents: write
+
+jobs:
+  goreleaser:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          # Allow goreleaser to access older tag information.
+          fetch-depth: 0
+      - uses: actions/setup-go@v4
+        with:
+          go-version-file: 'go.mod'
+          cache: true
+      - name: Import GPG key
+        uses: crazy-max/ghaction-import-gpg@v5
+        id: import_gpg
+        with:
+          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
+          passphrase: ${{ secrets.PASSPHRASE }}
+      - name: Run GoReleaser
+        uses: goreleaser/goreleaser-action@v4
+        with:
+          args: release --clean
+        env:
+          # GitHub sets the GITHUB_TOKEN secret automatically.
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PAT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
+          GPG_TTY: $(tty)
\ No newline at end of file
diff --git a/.goreleaser.yml b/.goreleaser.yml
new file mode 100644
index 0000000..3fb2cc3
--- /dev/null
+++ b/.goreleaser.yml
@@ -0,0 +1,86 @@
+# 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: 'kfutil'
+archives:
+  - format: zip
+    name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
+checksum:
+  extra_files:
+    - glob: 'integration-manifest.json'
+      name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
+  name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
+  algorithm: sha256
+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:
+  prerelease: auto
+  extra_files:
+    - glob: 'integration-manifest.json'
+      name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
+  # If you want to manually examine the release before its live, uncomment this line:
+  draft: true
+changelog:
+  sort: asc
+  use: github
+  filters:
+    exclude:
+      - '^test:'
+      - '^chore'
+      - 'merge conflict'
+      - Merge pull request
+      - Merge remote-tracking branch
+      - Merge branch
+      - go mod tidy
+  groups:
+    - title: Dependency updates
+      regexp: "^.*(feat|fix)\\(deps\\)*:+.*$"
+      order: 300
+    - title: 'New Features'
+      regexp: "^.*feat[(\\w)]*:+.*$"
+      order: 100
+    - title: 'Bug fixes'
+      regexp: "^.*fix[(\\w)]*:+.*$"
+      order: 200
+    - title: 'Documentation updates'
+      regexp: "^.*docs[(\\w)]*:+.*$"
+      order: 400
+    - title: Other work
+      order: 9999