forked from EmpireProject/Empire
-
-
Notifications
You must be signed in to change notification settings - Fork 579
49 lines (48 loc) · 1.69 KB
/
release-public-tag.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Public - Tag Release
on:
pull_request:
types:
- closed
branches:
- main
jobs:
tag_release:
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.repository == 'BC-Security/Empire' }}
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: 0
- name: Initialize mandatory git config
run: |
git config user.name "GitHub Actions"
git config user.email [email protected]
- name: Find last released tag
run: |
tags=$(git tag --list --sort=-version:refname "v*.*.*")
tags=$(echo "$tags" | grep -v -E "beta|alpha|rc|RC")
latest_tag=$(echo "$tags" | head -n 1)
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV
- name: Get app version
run: |
# Get the version from pyproject.toml using sed
echo "APP_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml)" >> $GITHUB_ENV
- name: Extract release notes
id: extract_release_notes
# This is modified to pull multiple versions of the release notes
uses: vinnybod/extract-release-notes@v2
with:
last_version: ${{ env.LATEST_TAG }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: v${{ env.APP_VERSION }}
release_name: v${{ env.APP_VERSION }}
body: ${{ steps.extract_release_notes.outputs.release_notes }}
draft: false
prerelease: false