-
Notifications
You must be signed in to change notification settings - Fork 131
78 lines (76 loc) · 2.85 KB
/
release.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
77
78
name: release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
release:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Read go version
id: go-version
uses: juliangruber/read-file-action@v1
with:
path: ./.go-version
-
name: Set up Go
uses: actions/setup-go@v1
with:
# TODO: Replace with go-version-from-file when it is supported
# https://github.com/actions/setup-go/pull/62
go-version: ${{ steps.go-version.outputs.content }}
-
name: Install hc-codesign
run: |
docker login docker.pkg.github.com -u docker -p '${{ secrets.CODESIGN_GITHUB_TOKEN }}' && \
docker pull docker.pkg.github.com/hashicorp/hc-codesign/hc-codesign:$VERSION && \
echo "::set-output name=image::docker.pkg.github.com/hashicorp/hc-codesign/hc-codesign:$VERSION"
id: codesign
env:
VERSION: v0
-
name: Install hc-releases
run: |
DOWNLOAD_URL=$(curl -SsL \
-H "Authorization: token ${{ secrets.CODESIGN_GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/hashicorp/hc-releases/releases/latest \
| jq -r '.assets[] | select(.name | contains("linux_amd64.tgz")) | .url')
curl -SsL -o /tmp/hc-releases.tgz \
-H "Authorization: token ${{ secrets.CODESIGN_GITHUB_TOKEN }}" \
-H "Accept: application/octet-stream" ${DOWNLOAD_URL}
tar xzf /tmp/hc-releases.tgz
sudo mv hc-releases /usr/bin/hc-releases
hc-releases version
-
name: Import PGP key for archive signing
run: echo -e "${{ secrets.PGP_SIGNING_KEY }}" | gpg --import
-
name: Release
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release
env:
PGP_USER_ID: ${{ secrets.PGP_USER_ID }}
RELEASE_AWS_ACCESS_KEY_ID: ${{ secrets.RELEASE_AWS_ACCESS_KEY_ID }}
RELEASE_AWS_SECRET_ACCESS_KEY: ${{ secrets.RELEASE_AWS_SECRET_ACCESS_KEY }}
CODESIGN_IMAGE: ${{ steps.codesign.outputs.image }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
CIRCLE_TOKEN: ${{ secrets.CIRCLE_TOKEN }}
-
name: Publish released artifacts
run: hc-releases publish -product=terraform-ls
env:
AWS_ACCESS_KEY_ID: ${{ secrets.RELEASE_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RELEASE_AWS_SECRET_ACCESS_KEY }}
FASTLY_API_TOKEN: ${{ secrets.RELEASE_FASTLY_API_TOKEN }}