-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
95 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
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 }} |
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