mirror of
https://github.com/subosito/flutter-action.git
synced 2024-08-16 10:19:50 +02:00
Fix temp folder handling on windows
Something with the globing seems not work but not sure exactly. Now using a simple way of ensure that the target folder never exists when calling `mv` so that it behaves as a rename instead of a move into. The folder still needs to be created first so that parent folders (in case of a custom cache path) are created.
This commit is contained in:
parent
05b7251cb1
commit
b3c14e7ecc
2 changed files with 17 additions and 6 deletions
9
.github/workflows/workflow.yml
vendored
9
.github/workflows/workflow.yml
vendored
|
@ -1,5 +1,12 @@
|
||||||
name: Main workflow
|
name: Main workflow
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test_channel:
|
test_channel:
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
|
14
setup.sh
14
setup.sh
|
@ -52,11 +52,17 @@ download_archive() {
|
||||||
|
|
||||||
curl --connect-timeout 15 --retry 5 $archive_url >$archive_local
|
curl --connect-timeout 15 --retry 5 $archive_url >$archive_local
|
||||||
|
|
||||||
|
# Create the target folder
|
||||||
|
mkdir -p "$2"
|
||||||
|
|
||||||
if [[ $archive_name == *zip ]]; then
|
if [[ $archive_name == *zip ]]; then
|
||||||
unzip -q -o "$archive_local" -d "$RUNNER_TEMP"
|
unzip -q -o "$archive_local" -d "$RUNNER_TEMP"
|
||||||
shopt -s dotglob
|
# Remove the folder again so that the move command can do a simple rename
|
||||||
mv ${RUNNER_TEMP}/flutter/* "$2"
|
# instead of moving the content into the target folder.
|
||||||
shopt -u dotglob
|
# This is a little bit of a hack since the "mv --no-target-directory"
|
||||||
|
# linux option is not available here
|
||||||
|
rm -r "$2"
|
||||||
|
mv ${RUNNER_TEMP}/flutter "$2"
|
||||||
else
|
else
|
||||||
tar xf "$archive_local" -C "$2" --strip-components=1
|
tar xf "$archive_local" -C "$2" --strip-components=1
|
||||||
fi
|
fi
|
||||||
|
@ -90,8 +96,6 @@ else
|
||||||
PUB_CACHE="${HOME}/.pub-cache"
|
PUB_CACHE="${HOME}/.pub-cache"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$SDK_CACHE"
|
|
||||||
|
|
||||||
if [[ ! -x "${SDK_CACHE}/bin/flutter" ]]; then
|
if [[ ! -x "${SDK_CACHE}/bin/flutter" ]]; then
|
||||||
if [[ $CHANNEL == master ]]; then
|
if [[ $CHANNEL == master ]]; then
|
||||||
git clone -b master https://github.com/flutter/flutter.git "$SDK_CACHE"
|
git clone -b master https://github.com/flutter/flutter.git "$SDK_CACHE"
|
||||||
|
|
Loading…
Reference in a new issue