Skip to content

main -> Create->Draft Release ( 1 ) #9

main -> Create->Draft Release ( 1 )

main -> Create->Draft Release ( 1 ) #9

---
name: Create->Draft Release
# yamllint disable rule:line-length
on:
workflow_dispatch:
inputs:
version:
description: 'The version for the release'
required: true
default: '0.0.0'
# set the run-name
run-name: ${{ github.ref_name }} -> Create->Draft Release (
${{ github.run_attempt }}
)
jobs:
validate:
name: Validates inputs
runs-on: ubuntu-latest
permissions:
contents: read
steps:
#validates that the version is a valid semver
- name: Validate version
id: validate_version
run: |
if [[ ! ${{ inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version: ${{ inputs.version }}"
exit 1
fi
create_draft_release:
name: Creates a draft release with version number as title
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Get current date and time
id: datetime
run: |
datetime=$(date +'%Y-%m-%dT%H-%M-%SZ')
echo "datetime=$datetime" >> $GITHUB_OUTPUT
- name: Display Run Name
run: echo ${{ steps.datetime.outputs.datetime }}
- name: Checkout
uses: actions/[email protected]
- name: Zip plugin folders
run: |
cd metaguide_interfaceplugin
zip -r ../metaguide_interfaceplugin_${{ inputs.version }}.zip .
cd ../metaguide_filetypeplugin
zip -r ../metaguide_filetypeplugin_${{ inputs.version }}.zip .
cd ../metaguide_outputplugin
zip -r ../metaguide_outputplugin_${{ inputs.version }}.zip .
cd ../metaguide_kobotouchplugin
zip -r ../metaguide_kobotouchplugin_${{ inputs.version }}.zip .
cd ..
- name: Create release branch
run: |
git checkout -b "release/${{ inputs.version }}"
git push origin "release/${{ inputs.version }}"
- name: Create DRAFT release through github cli and upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ inputs.version }} --title ${{ inputs.version }} --generate-notes --draft 'metaguide_interfaceplugin_${{ inputs.version }}.zip' 'metaguide_filetypeplugin_${{ inputs.version }}.zip' 'metaguide_outputplugin_${{ inputs.version }}.zip' 'metaguide_kobotouchplugin_${{ inputs.version }}.zip'