forked from kristofferahl/terraform-provider-healthchecksio
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (75 loc) · 2.61 KB
/
pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# 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: CI
on: [push, pull_request]
jobs:
build-test-release:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
-
name: Set up Goreleaser
run: |
mkdir -p "${TMPDIR:?}"
curl -sL https://git.io/goreleaser | bash -s -- --version
env:
TMPDIR: ${{ github.workspace }}/bin
VERSION: v0.162.0
-
name: Import GPG key
id: import_gpg
uses: paultyng/ghaction-import-gpg@v2.1.0
if: env.GPG_PRIVATE_KEY != '' && env.PASSPHRASE != ''
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
-
name: Build and sign
run: ./run build --sign
if: steps.import_gpg.outputs.fingerprint != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_BIN: ${{ github.workspace }}/bin/goreleaser
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
-
name: Build
run: ./run build
if: steps.import_gpg.outputs.fingerprint == ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_BIN: ${{ github.workspace }}/bin/goreleaser
-
name: Test
run: ./run test
-
name: Intergration Test
run: ./run docker test-integration
if: env.HEALTHCHECKSIO_API_KEY != ''
env:
HEALTHCHECKSIO_API_KEY: ${{ secrets.HEALTHCHECKSIO_API_KEY }}
-
name: Release on valid tag
if: github.repository == 'kristofferahl/terraform-provider-healthchecksio' && startsWith(github.ref, 'refs/tags/v')
run: ./run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_BIN: ${{ github.workspace }}/bin/goreleaser
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}