-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (59 loc) · 2.12 KB
/
build.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
name: Release Terraform Modules
on:
push:
tags:
- 'v*.*.*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- id: create-version
uses: paulhatch/[email protected]
with:
# The prefix to use to identify tags
tag_prefix: "v"
# A string which, if present in a git commit, indicates that a change represents a
# major (breaking) change, supports regular expressions wrapped with '/'
major_pattern: "(MAJOR)"
# Same as above except indicating a minor change, supports regular expressions wrapped with '/'
minor_pattern: "(MINOR)"
# A string to determine the format of the version output
version_format: "${major}.${minor}.${patch}"
# Prevents pre-v1.0.0 version from automatically incrementing the major version.
# If enabled, when the major version is 0, major releases will be treated as minor and minor as patch. Note that the version_type output is unchanged.
enable_prerelease_mode: true
# If enabled, diagnostic information will be added to the action output.
debug: false
# If true, the branch will be used to select the maximum version.
version_from_branch: false
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
- name: Validate Terraform
run: |
cd test
terraform init
terraform validate
cd ..
- name: Package Terraform modules
env:
VERSION: ${{ steps.create-version.outputs.version }}
run: |
mkdir -p release
for dir in modules/*
do
zip -r release/$(basename $dir)-${VERSION}.zip $dir
done
- name: Create release and upload assets
run: |
set -x
assets=()
for asset in ./release/*.zip; do
assets+=("$asset")
done
gh release create -t "Release ${VERSION}" ${VERSION}
gh release upload ${VERSION} ${assets[@]}
env:
VERSION: ${{ steps.create-version.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}