-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (52 loc) · 1.62 KB
/
main.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
# This will compile Terraform Bundle from source and upload the compiled binaries to the workflow run
name: main
on:
push:
branches:
- main
pull_request:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
terraform_core_version: [v0.12.31, v0.15.5]
steps:
# Install Go environment for build
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.10
# gox is simple go cross complication tool
- name: Install gox
run: go get github.com/mitchellh/gox
# Checkout the specified version of Terraform
- name: Checkout Terraform Bundle code
uses: actions/checkout@v2
with:
repository: 'hashicorp/terraform'
persist-credentials: 'false'
fetch-depth: 1
ref: ${{ matrix.terraform_core_version }}
path: terraform
token: ${{ secrets.GITHUB_TOKEN }}
# Run the complile
- name: Cross compile terraform-bundle
run: |
gox \
-os="linux darwin windows" \
-arch="amd64" \
-output "./bundle/${{ matrix.terraform_core_version }}/{{.OS}}_{{.Arch}}/terraform-bundle" \
./terraform/tools/terraform-bundle
# Upload the artifacts
- name: upload compiled binaries
uses: actions/upload-artifact@v2
with:
name: terraform-bundle
path: ./bundle/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}