Skip to content

Commit

Permalink
feat: Enable caching
Browse files Browse the repository at this point in the history
  • Loading branch information
AnimMouse committed Feb 7, 2024
1 parent 96cf641 commit 52c4222
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,23 @@ runs:
version: ${{ inputs.version }}
GITHUB_TOKEN: ${{ inputs.token }}

- name: Restore YouTube Uploader cache
id: cache
uses: actions/cache/restore@v4
with:
path: ${{ runner.tool_cache }}/youtubeuploader
key: youtubeuploader-${{ steps.version-unix-like.outputs.version || steps.version-windows.outputs.version }}-${{ runner.os }}

- name: Download YouTube Uploader for Unix-like
if: runner.os == 'Linux' || runner.os == 'macOS'
if: (runner.os == 'Linux' || runner.os == 'macOS') && ! steps.cache.outputs.cache-hit
shell: bash
working-directory: ${{ runner.temp }}
run: $GITHUB_ACTION_PATH/scripts/download/Unix-like.sh
env:
version: ${{ steps.version-unix-like.outputs.version }}

- name: Download YouTube Uploader for Windows
if: runner.os == 'Windows'
if: runner.os == 'Windows' && ! steps.cache.outputs.cache-hit
shell: pwsh
working-directory: ${{ runner.temp }}
run: '& $env:GITHUB_ACTION_PATH\scripts\download\Windows.ps1'
Expand All @@ -58,6 +65,7 @@ runs:
uses: AnimMouse/tool-cache@v1
with:
folder_name: youtubeuploader
cache_hit: ${{ steps.cache.outputs.cache-hit }}

- name: Sign in to YouTube Uploader on Unix-like
if: (runner.os == 'Linux' || runner.os == 'macOS') && (inputs.client_secrets != 'false' && inputs.request_token != 'false')
Expand All @@ -73,4 +81,11 @@ runs:
run: '& $env:GITHUB_ACTION_PATH\scripts\sign-in\Windows.ps1'
env:
client_secrets: ${{ inputs.client_secrets }}
request_token: ${{ inputs.request_token }}
request_token: ${{ inputs.request_token }}

- name: Save YouTube Uploader cache
if: '! steps.cache.outputs.cache-hit'
uses: actions/cache/save@v4
with:
path: ${{ runner.tool_cache }}/youtubeuploader
key: youtubeuploader-${{ steps.version-unix-like.outputs.version || steps.version-windows.outputs.version }}-${{ runner.os }}

0 comments on commit 52c4222

Please sign in to comment.