-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (51 loc) · 1.27 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
name: Lint & Version
on:
pull_request:
branches:
- main
push:
branches:
- main
defaults:
run:
shell: bash
jobs:
lint:
name: Lint Terraform
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.3.7
- name: terraform fmt
run: |
terraform fmt -check -recursive
versioning:
name: Bump Version
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
fetch-depth: '0'
- name: Extract branch name
id: extract_branch
run: |
if [ "$GITHUB_EVENT_NAME" == "push" ]; then
echo BRANCH_NAME=main >> $GITHUB_ENV
else
echo BRANCH_NAME=${{ github.head_ref }} >> $GITHUB_ENV
fi
- name: Bump version
id: bump_version
uses: anothrNick/github-tag-action@1.61.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INITIAL_VERSION: 1.0.0
DEFAULT_BUMP: minor
PRERELEASE_SUFFIX: ${{ env.BRANCH_NAME }}
PRERELEASE: ${{ !startsWith(env.BRANCH_NAME, 'main') }}
RELEASE_BRANCHES: main
WITH_V: true