1+ ---
12name : New release
23
3- on :
4+ on : # yamllint disable-line rule:truthy
5+ workflow_dispatch :
46 push :
57 branches :
68 - master
1012 runs-on : ubuntu-latest
1113 name : create release draft
1214 steps :
13- - uses : actions/checkout@v2
15+ - uses : actions/checkout@v3
1416 with :
1517 fetch-depth : 0
18+ ref : master
1619
1720 - name : ' Get Previous tag'
1821 id : previoustag
@@ -32,56 +35,46 @@ jobs:
3235 token : ${{ secrets.GITHUB_TOKEN }}
3336 future_release : ${{ steps.version.outputs.next-version }}
3437
35- - name : Generate changelog for the release
36- uses : charmixer/auto-changelog-action@v1
37- with :
38- token : ${{ secrets.GITHUB_TOKEN }}
39- since_tag : ${{ steps.previoustag.outputs.tag }}
40- future_release : ${{ steps.version.outputs.next-version }}
41- output : CHANGELOGRELEASE.md
4238
4339 - name : update inspec.yml
4440 uses : mikefarah/yq@3.2.1
4541 with :
4642 cmd : yq w -I4 -i inspec.yml version ${{ steps.version.outputs.next-version }} && sed -i '1i---' inspec.yml
4743
4844 - name : push inspec.yml and changelog
49- uses : github-actions-x/commit@v2.6
45+ uses : github-actions-x/commit@v2.9
5046 with :
5147 github-token : ${{ secrets.GITHUB_TOKEN }}
5248 push-branch : ' master'
5349 commit-message : ' update inspec.yml and changelog'
5450 files : inspec.yml CHANGELOG.md
5551 name : dev-sec CI
5652 email : hello@dev-sec.io
57- rebase : ' true'
53+ force-add : ' true'
54+
55+ - name : Generate changelog for the release
56+ run : |
57+ sed '/## \[${{ steps.previoustag.outputs.tag }}\]/Q' CHANGELOG.md > CHANGELOGRELEASE.md
5858
5959 - name : Read CHANGELOG.md
6060 id : package
6161 uses : juliangruber/read-file-action@v1
6262 with :
6363 path : ./CHANGELOGRELEASE.md
6464
65- - uses : actions/checkout@v2
66- with :
67- ref : master
68-
69- - name : Get current commitish
70- id : current_commitish
71- run : echo "::set-output name=sha::$(git log -1 --format="%H")"
72-
73- - name : Check it
74- run : echo ${{ steps.current_commitish.outputs.sha }}
65+ - name : Delete old drafts
66+ uses : hugo19941994/delete-draft-releases@v1.0.0
67+ env :
68+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7569
7670 - name : Create Release draft
7771 id : create_release
78- uses : actions/create-release@v1.1.2
72+ uses : actions/create-release@v1
7973 env :
80- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
74+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
8175 with :
8276 release_name : ${{ steps.version.outputs.next-version }}
8377 tag_name : ${{ steps.version.outputs.next-version }}
8478 body : |
8579 ${{ steps.package.outputs.content }}
86- commitish : ${{ steps.current_commitish.outputs.sha }}
8780 draft : true
0 commit comments