This repository has been archived by the owner on Dec 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (92 loc) · 3.27 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Create a new GitHub release on pushed tag stating with 'v'.
# Run tests, build and uploads binaries.
name: Release
on:
push:
tags:
- 'v*'
jobs:
test:
name: Release Test
runs-on: ubuntu-latest
steps:
- name: set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: check out code into the Go module directory
uses: actions/checkout@v2
- name: get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: sanity-check
run: make test
# See https://github.com/actions/upload-release-asset
build:
name: Build and Release
needs: test
runs-on: ubuntu-latest
steps:
- name: set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: check out code into the Go module directory
uses: actions/checkout@v2
- name: get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: parse version string
id: parse_version
run: |
export BUILD_VERSION=$(echo $GITHUB_REF | sed -e 's/refs.tags.\(.*\)$/\1/')
export BUILD_NAME=terraform-provider-rollbar_$BUILD_VERSION
echo "::set-output name=BUILD_NAME::$BUILD_NAME"
echo ::set-output name=ZIP_NAME_LINUX::"$BUILD_NAME"_linux_amd64.zip
echo ::set-output name=ZIP_NAME_DARWIN::"$BUILD_NAME"_darwin_amd64.zip
- name: build Linux
run: |
make build-linux
mv terraform-provider-rollbar ${{ steps.parse_version.outputs.BUILD_NAME }}
zip --junk-paths ${{ steps.parse_version.outputs.ZIP_NAME_LINUX }} ${{ steps.parse_version.outputs.BUILD_NAME }}
- name: build Darwin
run: |
make build-darwin
mv terraform-provider-rollbar ${{ steps.parse_version.outputs.BUILD_NAME }}
zip --junk-paths ${{ steps.parse_version.outputs.ZIP_NAME_DARWIN }} ${{ steps.parse_version.outputs.BUILD_NAME }}
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: upload Release Asset Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.parse_version.outputs.ZIP_NAME_LINUX }}
asset_name: ${{ steps.parse_version.outputs.ZIP_NAME_LINUX }}
asset_content_type: application/zip
- name: Upload Release Asset Darwin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.parse_version.outputs.ZIP_NAME_DARWIN }}
asset_name: ${{ steps.parse_version.outputs.ZIP_NAME_DARWIN }}
asset_content_type: application/zip