Skip to content

Commit

Permalink
Fix: Update PowerShell commands in build-and-release.yml for Flutter …
Browse files Browse the repository at this point in the history
…setup

- Added refreshenv command to ensure environment variables are updated.
- Ensured Import-Module and flutter version check are executed correctly.
  • Loading branch information
svc-design committed Oct 15, 2024
1 parent 8ccb735 commit f1b9fa5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ jobs:
if: ${{ matrix.platform == 'windows' }}
shell: powershell
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install flutter -y
echo "C:\\flutter\\bin" >> $GITHUB_ENV
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" # 加载环境变量
echo "C:\flutter\bin" >> $GITHUB_ENV
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
flutter --version
- name: Set up Flutter environment for Android
Expand All @@ -87,7 +88,7 @@ jobs:
export PATH="$PATH:/snap/bin"
java -version
flutter doctor
- name: Set up Flutter environment for macOS/iOS
if: ${{ matrix.platform == 'macos' || matrix.platform == 'ios' }}
run: |
Expand All @@ -107,7 +108,10 @@ jobs:
- name: Build Flutter packages for Windows
if: ${{ matrix.platform == 'windows' }}
shell: powershell
run: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
flutter build windows --release
env:
PLATFORM: ${{ matrix.platform }}
Expand Down

0 comments on commit f1b9fa5

Please sign in to comment.