1
+ name : Build and Publish
2
+ on :
3
+ push :
4
+ branches :
5
+ - main
6
+ pull_request :
7
+ jobs :
8
+ build_and_publish :
9
+ name : " Create Pkl package, tag and release"
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Checkout code
13
+ uses : actions/checkout@v3
14
+ with :
15
+ fetch-depth : 0
16
+
17
+ - name : Install tools
18
+ uses : asdf-vm/actions/install@v3
19
+
20
+ - name : Determine version bump level
21
+ id : determine_bump_level
22
+ run : echo "level=patch" >> $GITHUB_ENV
23
+
24
+ - name : Get Current Version
25
+ id : get_version
26
+ run : echo "current_version=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
27
+
28
+ - name : Calculate next version
29
+ id : get_semver
30
+ uses : rickstaa/action-get-semver@v1
31
+ with :
32
+ bump_level : ${{ env.level }}
33
+
34
+ - name : Set Project Version Output
35
+ id : project_version
36
+ run : |
37
+ echo "project_version=${{ steps.get_semver.outputs.next_version }}" >> $GITHUB_ENV
38
+ echo "project_version_without_v=$(echo ${{ steps.get_semver.outputs.next_version }} | tr -d 'v')" >> $GITHUB_ENV
39
+
40
+ - name : Substitute version
41
+ run : |
42
+ sed -i "s/0.0.0/${{ steps.project_version.outputs.project_version_without_v }}/g" PklProject
43
+
44
+ - name : Build Pkl package
45
+ run : pkl project package
46
+
47
+ - name : Apply tag
48
+ run : git tag ${{ steps.project_version.outputs.project_version }}
49
+ if : github.event.name == 'push' && github.event.ref == 'refs/heads/master'
50
+
51
+ - name : Release
52
+ uses : softprops/action-gh-release@v2
53
+ if : github.event_name == 'push' && github.event.ref == 'refs/heads/master'
54
+ with :
55
+ tag_name : ${{ steps.project_version.outputs.project_version }}
56
+ files : .out/terraform@${{env.project_version_without_v}}/*
57
+
58
+ - name : Push tag
59
+ if : github.event_name == 'push' && github.event.ref == 'refs/heads/master'
60
+ run : git push origin ${{ steps.project_version.outputs.project_version }}
0 commit comments