forked from EmpireProject/Empire
-
-
Notifications
You must be signed in to change notification settings - Fork 580
69 lines (68 loc) · 2.75 KB
/
release-public-start.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Public - Create Release Branch
on:
workflow_dispatch:
inputs:
sponsorTag:
description: 'The tag to merge into master and dev from the sponsors repo. Example: v4.5.2-private'
type: string
required: true
starkillerVersion:
description: 'Starkiller tag to use for the release. Example: v2.0.0'
type: string
required: false
jobs:
create_release:
if: ${{ github.repository == 'BC-Security/Empire' }}
runs-on: ubuntu-latest
steps:
- name: Check out sponsor repo
uses: actions/checkout@v3
with:
repository: 'BC-Security/Empire-Sponsors'
submodules: 'recursive'
ref: ${{ inputs.sponsorTag }}
token: ${{ secrets.RELEASE_TOKEN }}
fetch-depth: 0
- name: Add public repo
run: |
git remote add public https://github.com/BC-Security/empire.git
# recursing submodules in the fetch will cause remote error: upload-pack: not our ref since the
# remote for starkiller hasn't been synced yet
git fetch public --no-recurse-submodules
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Initialize mandatory git config
run: |
git config user.name "GitHub Actions"
git config user.email [email protected]
- 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: Get release branch name
run: |
echo "RELEASE_BRANCH=release/$APP_VERSION" >> $GITHUB_ENV
- name: Create release branch
run: |
git checkout -b ${{ env.RELEASE_BRANCH }}
- name: Update Starkiller Version
if: ${{ github.event.inputs.starkillerVersion }}
uses: ./.github/actions/update-starkiller
with:
starkiller-version: ${{ github.event.inputs.starkillerVersion }}
app-version: ${{ env.APP_VERSION }}
repo: 'https://github.com/BC-SECURITY/Starkiller.git'
- name: Push new branch
run: git push public ${{ env.RELEASE_BRANCH }}
- name: Create pull request into main
uses: thomaseizinger/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
head: ${{ env.RELEASE_BRANCH }}
base: main
title: v${{ env.APP_VERSION }} into main
reviewers: ${{ github.event.issue.user.login }}
body: |
This PR was automatically generated by the `release-public-start` workflow.
This PR should be merged with a merge commit, **not a squash commit.**
Merging this PR will trigger a tag and release automatically.