Add input validation to release action

This commit is contained in:
Send_Nukez 2021-10-26 22:35:08 +02:00
parent ffc31a8449
commit e17fb666a5
2 changed files with 10 additions and 4 deletions

View file

@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version of Release'
description: 'Version of Release (format: X.X.X)'
required: true
jobs:
@ -12,6 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Verify Input
run: |
[[ "${{ github.event.inputs.version }}" =~ ^[0-9]\.[0-9]\.[0-9]$ ]] && echo "Matches" && exit 0 || echo "Use versions like '1.2.3'" && exit 1
- name: Checkout
uses: actions/checkout@v2
with:
@ -38,11 +42,13 @@ jobs:
uses: montudor/action-zip@v1
- name: Zip Files
run: zip -r DribbblishDynamic_${{ github.event.inputs.version }}.zip *
run: zip -r DribbblishDynamic_v${{ github.event.inputs.version }}.zip *
working-directory: dist
- name: Release
uses: softprops/action-gh-release@v1
with:
name: v${{ github.event.inputs.version }}
tag_name: ${{ github.event.inputs.version }}
files: dist/DribbblishDynamic_${{ github.event.inputs.version }}.zip
files: dist/DribbblishDynamic_v${{ github.event.inputs.version }}.zip
fail_on_unmatched_files : true

View file

@ -43,7 +43,7 @@ module.exports = {
cleanAfterEveryBuildPatterns: ["*.LICENSE.txt"]
}),
new webpack.DefinePlugin({
"process.env.DRIBBBLISH_VERSION": JSON.stringify((process.env.DRIBBBLISH_VERSION || "vDev").substring(1)) // Substring because the script expects the version to be `X.X.X` and not `vX.X.X`
"process.env.DRIBBBLISH_VERSION": JSON.stringify(process.env.DRIBBBLISH_VERSION || "Dev")
}),
new CopyPlugin({
patterns: [{ from: "src/assets", to: "assets" }, { from: "src/color.ini" }]