deskflow/.github/actions/dist-upload/action.yml
Nick Bolton d063e08942
Also cut + char for SHORT_VERSION var used on upload (#7465)
* Also cut + when creating `SHORT_VERSION` var for upload

* Update ChangeLog
2024-09-02 16:18:34 +01:00

70 lines
2.0 KiB
YAML

name: "Distribute upload"
description: "Uploads the package from the dist dir to GitHub artifacts or Google Drive"
inputs:
use_github:
description: "Whether to upload to GitHub artifacts"
required: true
use_gdrive:
description: "Whether to upload to Google Drive"
required: true
github-target-filename:
description: "Filename to upload (GitHub artifacts)"
required: true
gdrive-target-base-dir:
description: "Base directory to upload (Google Drive)"
required: true
gdrive-secret-key:
description: "Google Drive secret key"
required: true
gdrive-parent-folder-id:
description: "Google Drive parent folder ID"
required: true
package-version:
description: "Package version appended to the Google Drive dir"
required: true
runs:
using: "composite"
steps:
- if: ${{ inputs.use_gdrive == inputs.use_github }}
run: |
echo "Either 'use_github' or 'use_gdrive' must be true (and not both)"
exit 1
shell: bash
- if: ${{ inputs.use_gdrive == 'true' && !inputs.package-version }}
run: |
echo "Input 'package-version' is required when uploading to Google Drive"
exit 1
shell: bash
- if: ${{ inputs.use_gdrive == 'true' }}
run: |
SHORT_VERSION=$(echo "${{ inputs.package-version }}" | cut -d'-' -f1 | cut -d'+' -f1)
echo "SHORT_VERSION=$SHORT_VERSION" >> $GITHUB_ENV
shell: bash
- name: Upload to GitHub
if: ${{ inputs.use_github == 'true' }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.github-target-filename }}
path: ./dist
retention-days: 3
- name: Upload to Google Drive
if: ${{ inputs.use_gdrive == 'true' }}
uses: symless/gdrive-upload@target-glob
with:
credentials: ${{ inputs.gdrive-secret-key }}
target: "./dist/*"
parent_folder_id: ${{ inputs.gdrive-parent-folder-id }}
child_folder: Packages/${{ inputs.gdrive-target-base-dir }}/${{ env.SHORT_VERSION }}/${{ inputs.package-version }}