From 9ba856abd444c550681bce58ebd9bd23b7fd64fe Mon Sep 17 00:00:00 2001 From: jboulanger Date: Wed, 7 Oct 2020 11:39:55 +0200 Subject: [PATCH 1/4] chore(provider): publish provider --- .github/workflows/release.yml | 61 ++++++++++++++++++++++++++ .github/workflows/test-and-release.yml | 44 ------------------- .goreleaser.yml | 54 +++++++++++++++++++++++ 3 files changed, 115 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/test-and-release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..a9ad6477 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +# 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 (paultyng/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: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13.x + + - name: Test + run: make test GO111MODULE=on + goreleaser: + runs-on: ubuntu-latest + needs: test + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Unshallow + run: git fetch --prune --unshallow + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + - + name: Import GPG key + id: import_gpg + uses: paultyng/ghaction-import-gpg@v2.1.0 + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + PASSPHRASE: ${{ secrets.PASSPHRASE }} + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml deleted file mode 100644 index 408e8185..00000000 --- a/.github/workflows/test-and-release.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Test and release - -on: - pull_request: - push: - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Go 1.13 - uses: actions/setup-go@v1 - with: - go-version: 1.13.x - - - name: Test - run: make test GO111MODULE=on - - release: - runs-on: ubuntu-latest - needs: test - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Unshallow - run: git fetch --prune --unshallow - - - name: Set up Go 1.13 - uses: actions/setup-go@v1 - with: - go-version: 1.13.x - - - name: Release - uses: goreleaser/goreleaser-action@v1 - with: - version: latest - args: release --rm-dist --release-notes <(git tag -l --format='%(tag) (%(taggerdate:short))' $GITHUB_REF ; git tag -l --format='%(body)' $GITHUB_REF) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..da82a806 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,54 @@ +# 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 +signs: + - artifacts: checksum + args: + # if you are using this is 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 +changelog: + skip: true From 3b9136967f24967f6cb6a60508bba4327a4a5ba2 Mon Sep 17 00:00:00 2001 From: jboulanger Date: Mon, 19 Oct 2020 17:28:52 +0200 Subject: [PATCH 2/4] fix(workflow): change workflow --- .github/workflows/release.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9ad6477..0bc9c165 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,11 +9,11 @@ # 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 +name: Test and release on: + pull_request: push: - tags: - - 'v*' + jobs: test: runs-on: ubuntu-latest @@ -21,16 +21,17 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Set up Go 1.13 + - name: Set up Go 1.15.2 uses: actions/setup-go@v1 with: - go-version: 1.13.x + go-version: 1.15.2 - name: Test run: make test GO111MODULE=on goreleaser: runs-on: ubuntu-latest needs: test + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') steps: - name: Checkout From a2cd295400a29ce607748bc96501d79900fdadc5 Mon Sep 17 00:00:00 2001 From: jboulanger Date: Tue, 20 Oct 2020 10:47:45 +0200 Subject: [PATCH 3/4] fix(ci): bump versions --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0bc9c165..d2a1f203 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,10 +21,10 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Set up Go 1.15.2 + - name: Set up Go 1.15.3 uses: actions/setup-go@v1 with: - go-version: 1.15.2 + go-version: 1.15.3 - name: Test run: make test GO111MODULE=on @@ -43,11 +43,11 @@ jobs: name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.14 + go-version: 1.15.3 - name: Import GPG key id: import_gpg - uses: paultyng/ghaction-import-gpg@v2.1.0 + uses: crazy-max/ghaction-import-gpg@v3.0.1 env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} PASSPHRASE: ${{ secrets.PASSPHRASE }} From a6e0b98e633cc54441f08d6fc9bb61b60c0ab91e Mon Sep 17 00:00:00 2001 From: azman0101 Date: Tue, 20 Oct 2020 11:41:12 +0200 Subject: [PATCH 4/4] fix(comment): change minor comments Co-authored-by: Patrick Decat --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d2a1f203..6d8d62a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ # 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). +# Currently it's setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). # # This uses an action (paultyng/ghaction-import-gpg) that assumes you set your # private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` @@ -48,9 +48,9 @@ jobs: name: Import GPG key id: import_gpg uses: crazy-max/ghaction-import-gpg@v3.0.1 - env: - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - PASSPHRASE: ${{ secrets.PASSPHRASE }} + with: + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.PASSPHRASE }} - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2