Public - Create Release Branch #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |