π¦ Create Release #2
Workflow file for this run
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: π¦ Create Release | |
on: | |
workflow_dispatch: | |
jobs: | |
create-release: | |
name: π Create Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Set environment | |
id: set-environment | |
run: | | |
if [[ "${{ github.ref_name }}" == "release-candidate/"* ]]; then | |
echo "ENVIRONMENT=Release" >> $GITHUB_ENV | |
else | |
echo "Release needs to be created from release-candidate branches" | |
exit 1 | |
fi | |
- uses: actions/checkout@v3.2.0 | |
with: | |
fetch-depth: "0" | |
- name: β Extract project version | |
shell: bash | |
run: | | |
VERSION=$( echo ${{ github.ref_name }} | sed -e "s/release.*\///g") | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: πͺ£ Init Git | |
shell: bash | |
run: | | |
git config --global user.email "svc@users.noreply.github.com" | |
git config --global user.name "svc" | |
- name: βοΈ Set release branch parameters | |
id: get-release-branch | |
run: | | |
echo "BRANCH_RELEASE=release/${{ env.VERSION }}" >> $GITHUB_ENV | |
echo "RELEASE_CANDIDATE_SHA=$(git rev-parse ${{ github.ref_name }})" >> $GITHUB_ENV | |
- name: π Create Branch release | |
uses: peterjgrainger/action-create-branch@v2.4.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.SVC_GITHUB_TOKEN }} | |
with: | |
branch: ${{ env.BRANCH_RELEASE }} | |
sha: "${{ env.RELEASE_CANDIDATE_SHA }}" | |
- uses: actions/checkout@v3.2.0 | |
with: | |
token: ${{ secrets.SVC_GITHUB_TOKEN }} | |
ref: ${{ env.BRANCH_RELEASE }} | |
clean: true | |
fetch-depth: "0" | |
- name: β Wait for build to be triggered | |
shell: bash | |
run: sleep 30 | |
- name: β Wait for build to complete | |
uses: ./.github/actions/utils/wait-job | |
with: | |
BRANCH: ${{ env.BRANCH_RELEASE }} | |
GITHUB_TOKEN: ${{ secrets.SVC_GITHUB_TOKEN }} | |
- name: ποΈ Delete Release Candidate branch | |
continue-on-error: true | |
uses: dawidd6/action-delete-branch@v3.1.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branches: "release-candidate/${{ env.VERSION }}" | |