Skip to content

Commit 489fa01

Browse files
authored
Update release.yml
1 parent a1bb935 commit 489fa01

File tree

1 file changed

+20
-33
lines changed

1 file changed

+20
-33
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
---
12
name: New release
23

3-
on:
4+
on: # yamllint disable-line rule:truthy
5+
workflow_dispatch:
46
push:
57
branches:
68
- master
@@ -10,9 +12,10 @@ jobs:
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,40 @@ 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
42-
43-
- name: update inspec.yml
44-
uses: mikefarah/yq@3.2.1
45-
with:
46-
cmd: yq w -I4 -i inspec.yml version ${{ steps.version.outputs.next-version }} && sed -i '1i---' inspec.yml
47-
48-
- name: push inspec.yml and changelog
49-
uses: github-actions-x/commit@v2.6
38+
- name: push changelog
39+
uses: github-actions-x/commit@v2.9
5040
with:
5141
github-token: ${{ secrets.GITHUB_TOKEN }}
5242
push-branch: 'master'
53-
commit-message: 'update inspec.yml and changelog'
54-
files: inspec.yml CHANGELOG.md
43+
commit-message: 'update changelog'
44+
force-add: 'true'
45+
files: CHANGELOG.md
5546
name: dev-sec CI
5647
email: hello@dev-sec.io
57-
rebase: 'true'
48+
49+
- name: Generate changelog for the release
50+
run: |
51+
sed '/## \[${{ steps.previoustag.outputs.tag }}\]/Q' CHANGELOG.md > CHANGELOGRELEASE.md
5852
5953
- name: Read CHANGELOG.md
6054
id: package
6155
uses: juliangruber/read-file-action@v1
6256
with:
6357
path: ./CHANGELOGRELEASE.md
6458

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 }}
59+
- name: Delete old drafts
60+
uses: hugo19941994/delete-draft-releases@v1.0.0
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7563

7664
- name: Create Release draft
7765
id: create_release
78-
uses: actions/create-release@v1.1.2
66+
uses: actions/create-release@v1
7967
env:
80-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
8169
with:
8270
release_name: ${{ steps.version.outputs.next-version }}
8371
tag_name: ${{ steps.version.outputs.next-version }}
8472
body: |
8573
${{ steps.package.outputs.content }}
86-
commitish: ${{ steps.current_commitish.outputs.sha }}
8774
draft: true

0 commit comments

Comments
 (0)