6
6
- main
7
7
types : [ closed ]
8
8
9
-
10
9
jobs :
11
10
changelog :
12
11
uses : ./.github/workflows/changelog.yml
13
12
release :
14
- if : github.event.pull_request.merged == true
13
+ if : needs.changelog.outputs.release-type != 'no-release'
15
14
needs : [ changelog ]
16
15
runs-on : ubuntu-latest
17
16
steps :
18
17
- name : Checkout
19
- uses : actions/checkout@v2
18
+ uses : actions/checkout@v4
20
19
with :
21
20
token : ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
22
21
23
22
- name : Configure Git author
24
23
run : |
25
24
git config --global user.name "Open Terms Archive Release Bot"
26
25
git config --global user.email "[email protected] "
27
-
28
- - name : Install Semver
29
- run : npm i -g semver
30
-
31
- - name : Get current version
32
- id : get_current_version
33
- uses : mikefarah/yq@master
34
- with :
35
- cmd : yq '.version' galaxy.yml
36
26
37
- - name : Bump version
38
- run : |
39
- echo "Found release type '${{ env.RELEASE_TYPE }}'"
40
- echo "NEW_VERSION=$(semver -i $RELEASE_TYPE ${{ steps.get_current_version.outputs.result }})" >> $GITHUB_ENV
41
- env :
42
- RELEASE_TYPE : ${{ needs.changelog.outputs.release_type }}
43
-
44
- - name : Update changelog unreleased section with new version
45
- uses : superfaceai/release-changelog-action@v2
46
- with :
47
- path-to-changelog : CHANGELOG.md
48
- version : ${{ env.NEW_VERSION }}
49
- operation : release
50
- format : markdownlint
27
+ - name : Update changelog for release
28
+ id : release-changelog
29
+ uses :
OpenTermsArchive/manage-changelog/[email protected]
51
30
52
31
- name : Build Collection
53
32
uses : artis3n/ansible_galaxy_collection@v2
54
33
with :
55
34
api_key : ' ${{ secrets.GALAXY_API_KEY }}'
56
- galaxy_version : ' ${{ env.NEW_VERSION }}'
35
+ galaxy_version : ' ${{ steps.release-changelog.outputs.version }}'
57
36
build : true
58
37
publish : false
59
38
60
- - name : Commit CHANGELOG.md and create tag
39
+ - name : Commit CHANGELOG.md and galaxy.yml changes and create tag
61
40
run : |
62
- git add "CHANGELOG.md"
63
- git add "galaxy.yml"
64
- git commit -m "Release ${{ env.NEW_VERSION }}"
65
- git tag ${{ env.NEW_VERSION }}
66
-
41
+ git add "CHANGELOG.md" "galaxy.yml"
42
+ git commit -m "Release ${{ steps.release-changelog.outputs.version }}"
43
+ git tag v${{ steps.release-changelog.outputs.version }}
44
+
67
45
- name : Run status checks for release commit on temporary branch # Use temporary branch to enable pushing commits to this branch protected by required status checks
68
46
uses : CasperWA/push-protected@v2
69
47
with :
@@ -73,24 +51,13 @@ jobs:
73
51
74
52
- name : Push changes to repository
75
53
run : git push origin && git push --tags
76
- env :
77
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78
-
79
- - name : Read version changelog
80
- uses : superfaceai/release-changelog-action@v2
81
- id : get-changelog
82
- with :
83
- path-to-changelog : CHANGELOG.md
84
- version : ${{ env.NEW_VERSION }}
85
- operation : read
86
54
87
- - name : Update GitHub release with changelog
55
+ - name : Create GitHub release
88
56
uses : softprops/action-gh-release@v1
89
57
with :
90
- tag_name : ${{ env.NEW_VERSION }}
91
- body : ${{ steps.get-changelog.outputs.changelog }}
92
- env :
93
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58
+ tag_name : v${{ steps.release-changelog.outputs.version }}
59
+ body : ${{ steps.release-changelog.outputs.content }}
60
+ token : ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
94
61
95
62
- name : Publish Collection on Ansible Galaxy
96
63
uses : artis3n/ansible_galaxy_collection@v2
99
66
build : false
100
67
publish : true
101
68
69
+ clean_changelog :
70
+ if : needs.changelog.outputs.release-type == 'no-release'
71
+ needs : [ changelog ]
72
+ runs-on : ubuntu-latest
73
+ steps :
74
+ - uses : actions/checkout@v4
75
+ with :
76
+ token : ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
77
+
78
+ - name : Configure Git author
79
+ run : |
80
+ git config --global user.name "Open Terms Archive Release Bot"
81
+ git config --global user.email "[email protected] "
82
+
83
+ - name : Update changelog for release
84
+ uses :
OpenTermsArchive/manage-changelog/[email protected]
85
+
86
+ - name : Erase unreleased information from changelog
87
+ run : |
88
+ git commit -m "Clean changelog" CHANGELOG.md
89
+ git push origin
0 commit comments