Skip to content

Commit 582fa3e

Browse files
Merge pull request #8 from dev-sec/release_workflow
github actions release
2 parents 31cbfcd + 562c420 commit 582fa3e

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: New release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
generate_changelog:
10+
runs-on: ubuntu-latest
11+
name: create release draft
12+
steps:
13+
- uses: actions/checkout@v1
14+
15+
- name: 'Get Previous tag'
16+
id: previoustag
17+
uses: "WyriHaximus/github-action-get-previous-tag@master"
18+
env:
19+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
20+
21+
- name: calculate next version
22+
id: version
23+
uses: patrickjahns/version-drafter-action@v1
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Generate changelog
28+
uses: charmixer/auto-changelog-action@8095796
29+
with:
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
future_release: ${{ steps.version.outputs.next-version }}
32+
33+
- name: Generate changelog for the release
34+
uses: charmixer/auto-changelog-action@8095796
35+
with:
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
since_tag: ${{ steps.previoustag.outputs.tag }}
38+
future_release: ${{ steps.version.outputs.next-version }}
39+
output: CHANGELOGRELEASE.md
40+
41+
- name: update inspec.yml
42+
uses: mikefarah/yq@3.2.1
43+
with:
44+
cmd: yq w -I4 -i inspec.yml version ${{ steps.version.outputs.next-version }} && sed -i '1i---' inspec.yml
45+
46+
- name: push inspec.yml and changelog
47+
uses: github-actions-x/commit@v2.6
48+
with:
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
50+
push-branch: 'master'
51+
commit-message: 'update inspec.yml and changelog'
52+
force-add: 'true'
53+
files: inspec.yml CHANGELOG.md
54+
name: dev-sec CI
55+
email: hello@dev-sec.io
56+
57+
- name: Read CHANGELOG.md
58+
id: package
59+
uses: juliangruber/read-file-action@v1
60+
with:
61+
path: ./CHANGELOGRELEASE.md
62+
63+
- name: Create Release draft
64+
id: create_release
65+
uses: actions/create-release@v1
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
68+
with:
69+
release_name: ${{ steps.version.outputs.next-version }}
70+
tag_name: ${{ steps.version.outputs.next-version }}
71+
body: |
72+
${{ steps.package.outputs.content }}
73+
draft: true

0 commit comments

Comments
 (0)