Skip to content

Commit f24035e

Browse files
authored
Update release.yml
1 parent f191792 commit f24035e

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- uses: actions/checkout@v2
1414
with:
1515
fetch-depth: 0
16+
ref: master
1617

1718
- name: 'Get Previous tag'
1819
id: previoustag
@@ -46,42 +47,38 @@ jobs:
4647
cmd: yq w -I4 -i inspec.yml version ${{ steps.version.outputs.next-version }} && sed -i '1i---' inspec.yml
4748

4849
- name: push inspec.yml and changelog
49-
uses: github-actions-x/commit@v2.6
50+
uses: github-actions-x/commit@v2.9
5051
with:
5152
github-token: ${{ secrets.GITHUB_TOKEN }}
5253
push-branch: 'master'
5354
commit-message: 'update inspec.yml and changelog'
5455
files: inspec.yml CHANGELOG.md
5556
name: dev-sec CI
5657
email: hello@dev-sec.io
57-
rebase: 'true'
58+
force-add: 'true'
5859

60+
- name: Generate changelog for the release
61+
run: |
62+
sed '/## \[${{ steps.previoustag.outputs.tag }}\]/Q' CHANGELOG.md > CHANGELOGRELEASE.md
5963
- name: Read CHANGELOG.md
6064
id: package
6165
uses: juliangruber/read-file-action@v1
6266
with:
6367
path: ./CHANGELOGRELEASE.md
6468

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 }}
69+
- name: Delete old drafts
70+
uses: hugo19941994/delete-draft-releases@v1.0.0
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7573

7674
- name: Create Release draft
7775
id: create_release
78-
uses: actions/create-release@v1.1.2
76+
uses: actions/create-release@v1
7977
env:
80-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
8179
with:
8280
release_name: ${{ steps.version.outputs.next-version }}
8381
tag_name: ${{ steps.version.outputs.next-version }}
8482
body: |
8583
${{ steps.package.outputs.content }}
86-
commitish: ${{ steps.current_commitish.outputs.sha }}
8784
draft: true

0 commit comments

Comments
 (0)