Skip to content

Instantly share code, notes, and snippets.

@bxb100
Created October 12, 2022 04:46
Show Gist options
  • Save bxb100/d2fedcb3cdc897062ee03920d6ae83be to your computer and use it in GitHub Desktop.
Save bxb100/d2fedcb3cdc897062ee03920d6ae83be to your computer and use it in GitHub Desktop.
create draft release
create_draft_release:
name: Create Github draft release
runs-on: ubuntu-latest
steps:
- name: Audit gh version
run: gh --version
- name: Check for existing release
id: check_release
run: |
echo "::echo::on"
gh release view --repo '${{ github.repository }}' '${{ github.event.inputs.tag }}' \
&& echo "::set-output name=already_exists::true" \
|| echo "::set-output name=already_exists::false"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repo
if: steps.check_release.outputs.already_exists == 'false'
uses: actions/checkout@v3
with:
ref: "${{ github.event.inputs.ref }}"
- name: Create release
if: steps.check_release.outputs.already_exists == 'false'
run: >
gh release create
'${{ github.event.inputs.tag }}'
--draft
--repo '${{ github.repository }}'
--title '${{ github.event.inputs.tag }}'
--target '${{ github.event.inputs.ref }}'
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment