-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (69 loc) · 2.07 KB
/
tf-modules-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: TF Modules - Create a new release
on:
push:
branches:
- main
paths:
- "terraform/modules/**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
id-token: write
contents: write
jobs:
changed-modules:
name: Get changed files
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
json: true
quotepath: false
escape_json: false
dir_names: 'true'
files: terraform/modules/**
dir_names_max_depth: '3'
- name: List all changed files
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
release:
runs-on: ubuntu-latest
needs: changed-modules
strategy:
fail-fast: false
max-parallel: 1
matrix:
module: ${{ fromJson(needs.changed-modules.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: extract_module
run: |
module=$(echo '${{ matrix.module }}' | sed 's|modules/||')
echo "module=${module}" >> $GITHUB_OUTPUT
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
release_branches: main
default_bump: "patch"
tag_prefix: "${{ steps.extract_module.outputs.module }}-v"
create_annotated_tag: true
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
tag_name: ${{ steps.tag_version.outputs.new_tag }}
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}