Skip to content

Commit 131ac3e

Browse files
authored
Update Vampire/setup-wsl@v2 (#211)
Also: * Remove `yq` installation via brew/wget * Remove `setup-homebrew` actions
1 parent 586fa7e commit 131ac3e

File tree

3 files changed

+24
-32
lines changed

3 files changed

+24
-32
lines changed

.github/workflows/flutter.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3
16-
- name: Setup Homebrew
17-
uses: Homebrew/actions/setup-homebrew@master
1816
- name: Prepare repo
19-
run: bash ./.github/workflows/prepare.sh
17+
run: |
18+
set -e
19+
20+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
21+
bash ./.github/workflows/prepare.sh
2022
2123
- name: Setup Flutter
2224
uses: subosito/flutter-action@v2
@@ -68,8 +70,6 @@ jobs:
6870
runs-on: macos-latest
6971
steps:
7072
- uses: actions/checkout@v3
71-
- name: Setup Homebrew
72-
uses: Homebrew/actions/setup-homebrew@master
7373
- name: Prepare repo
7474
run: bash ./.github/workflows/prepare.sh
7575

@@ -133,10 +133,12 @@ jobs:
133133
runs-on: ubuntu-latest
134134
steps:
135135
- uses: actions/checkout@v3
136-
- name: Setup Homebrew
137-
uses: Homebrew/actions/setup-homebrew@master
138136
- name: Prepare repo
139-
run: bash ./.github/workflows/prepare.sh
137+
run: |
138+
set -e
139+
140+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
141+
bash ./.github/workflows/prepare.sh
140142
141143
- name: Setup Flutter
142144
uses: subosito/flutter-action@v2
@@ -200,8 +202,6 @@ jobs:
200202
runs-on: macos-latest
201203
steps:
202204
- uses: actions/checkout@v3
203-
- name: Setup Homebrew
204-
uses: Homebrew/actions/setup-homebrew@master
205205
- name: Prepare repo
206206
run: bash ./.github/workflows/prepare.sh
207207

@@ -268,9 +268,10 @@ jobs:
268268
shell: bash
269269
steps:
270270
- uses: actions/checkout@v3
271-
- uses: Vampire/setup-wsl@v1
271+
- uses: Vampire/setup-wsl@v2
272272
with:
273-
additional-packages: ca-certificates file git git-crypt gettext wget
273+
additional-packages: bash file git-crypt yq
274+
distribution: Alpine
274275
- name: Prepare repo
275276
run: bash ./.github/workflows/prepare.sh
276277
shell: wsl-bash {0}

.github/workflows/prepare.sh

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,30 @@
22

33
set -eo pipefail
44

5-
# Unlock git-crypt
5+
# 1. Unlock git-crypt
6+
# We could not use the existing GitHub action because it doesn't support Windows
7+
# https://github.com/sliteteam/github-action-git-crypt-unlock/blob/master/entrypoint.sh
68
if ! command -v git-crypt &>/dev/null; then
79
brew install git-crypt
810
fi
9-
# https://github.com/sliteteam/github-action-git-crypt-unlock/blob/master/entrypoint.sh
10-
echo "${GIT_CRYPT_KEY}" | base64 --decode >./git-crypt-key
11+
echo "${GIT_CRYPT_KEY}" | base64 -d >./git-crypt-key
1112
file lib/config.encrypted.dart
1213
git-crypt unlock ./git-crypt-key
1314
file lib/config.encrypted.dart
1415
rm ./git-crypt-key
1516

16-
# Extract config from pubspec.yaml
17-
if ! command -v yq &>/dev/null; then
18-
if ! command -v brew &>/dev/null; then
19-
_os=$(uname -s | tr '[:upper:]' '[:lower:]')
20-
_arch=amd64
21-
wget "https://github.com/mikefarah/yq/releases/download/v4.12.1/yq_${_os}_${_arch}" --quiet -O /usr/bin/yq && chmod +x /usr/bin/yq
22-
else
23-
brew install yq
24-
fi
25-
fi
26-
17+
# 2. Patch app version with monotonic build number
2718
_appVersion=$(yq e '.version' pubspec.yaml)
2819
echo "_appVersion=${_appVersion}"
2920
_appVersionWithBuildNumber=$(printf '.version="%s+%d"' "${_appVersion}" "${GITHUB_RUN_NUMBER}${GITHUB_RUN_ATTEMPT}")
3021
echo "_appVersionWithBuildNumber=${_appVersionWithBuildNumber}"
3122
yq --inplace e "$_appVersionWithBuildNumber" pubspec.yaml
3223
cat pubspec.yaml
3324

25+
# 3. Expose Flutter version
3426
if command -v wslpath &>/dev/null; then
3527
_wslGithubEnv=$(wslpath -u "$GITHUB_ENV")
3628
export "GITHUB_ENV=${_wslGithubEnv}"
3729
fi
38-
3930
_flutterVersion=$(yq e '.environment.flutter' pubspec.yaml)
4031
echo "FLUTTER_VERSION=${_flutterVersion}" | tee -a $GITHUB_ENV

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14-
- name: Setup Homebrew
15-
uses: Homebrew/actions/setup-homebrew@master
1614
- name: Prepare repo
17-
run: bash ./.github/workflows/prepare.sh
15+
run: |
16+
set -e
17+
18+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
19+
bash ./.github/workflows/prepare.sh
1820
1921
- name: Setup Flutter
2022
uses: subosito/flutter-action@v2
@@ -38,8 +40,6 @@ jobs:
3840
runs-on: macos-latest
3941
steps:
4042
- uses: actions/checkout@v3
41-
- name: Setup Homebrew
42-
uses: Homebrew/actions/setup-homebrew@master
4343
- name: Prepare repo
4444
run: bash ./.github/workflows/prepare.sh
4545

0 commit comments

Comments
 (0)