Skip to content

Commit

Permalink
Add release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSuisse committed Dec 11, 2023
1 parent 92b7daf commit 0e6c0ba
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
23 changes: 8 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ env:
NIXPKGS_ALLOW_UNFREE: 1

jobs:
build:
runs-on: ubuntu-22.04
name: Build
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: cachix/install-nix-action@7ac1ec25491415c381d9b62f0657c7a028df52a7
- run: nix-shell --run 'go build'
- run: ./terraform-provider-mailjet --help
static_analysis:
runs-on: ubuntu-22.04
name: Run static analysis and linting
Expand All @@ -31,18 +39,3 @@ jobs:
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
test_release:
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
name: Test release
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: cachix/install-nix-action@7ac1ec25491415c381d9b62f0657c7a028df52a7
- run: nix-shell --run 'goreleaser --snapshot --clean'
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: test-release-dist
path: dist/**/*
retention-days: 2
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write
id-token: write

jobs:
goreleaser:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0
- uses: cachix/install-nix-action@7ac1ec25491415c381d9b62f0657c7a028df52a7
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- run: nix-shell --run 'goreleaser --clean'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
15 changes: 15 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
- id: cosign-keyless
signature: "${artifact}.bundle"
cmd: cosign
args: [ "sign-blob", "--bundle", "${signature}", "--yes", "${artifact}" ]
artifacts: all
release:
extra_files:
- glob: 'terraform-registry-manifest.json'
Expand Down

0 comments on commit 0e6c0ba

Please sign in to comment.