Create Release #1
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: | |
inputs: | |
is_draft: | |
description: 'Create a draft of the release:' | |
type: boolean | |
required: true | |
default: false | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fail if branch is not main | |
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' | |
run: | | |
echo "This workflow should not be triggered with workflow_dispatch on a branch other than main" | |
exit 1 | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Get Current Version | |
id: get_version | |
shell: pwsh | |
run: | | |
Import-Module ./solution-helper.psm1 -Force | |
$version = Get-Version | |
echo "version_tag=$version" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- name: Create Release | |
run: | | |
if [[ ${{ github.event.inputs.is_draft }} ]]; then | |
gh release create ${{ env.version_tag }} --target ${{ github.ref_name }} --title ${{ env.version_tag }} --generate-notes --draft --latest | |
else | |
gh release create ${{ env.version_tag }} --target ${{ github.ref_name }} --title ${{ env.version_tag }} --generate-notes --latest | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |