Skip to content

Commit e3e10ef

Browse files
committed
fix(ci): install Flutter from a pinned archive instead of subosito/flutter-action
The org Actions policy admits GitHub-owned actions only, so subosito/flutter-action could not resolve even SHA-pinned, and every workflow referencing it failed at startup with no check reported. The nine green checks on this PR are all Wiz/Snyk/semgrep — no build has ever run here. There is no actions/setup-flutter, so the SDK is fetched from the official release archive and verified against its published SHA-256 (flutter_linux_3.29.2-stable.tar.xz), cached by version in the tool cache. That is a stronger supply-chain guarantee than the action it replaces, which SHA-pins its own code but not the SDK it downloads. Artifactory OIDC stays on the repo-local action: twilio/sdk-actions covers npm, python, ruby, php, go, maven, dotnet and gradle, but not pub/dart.
1 parent 41ad8ea commit e3e10ef

3 files changed

Lines changed: 85 additions & 12 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Setup Flutter"
2+
description: "Install a pinned Flutter SDK from the official release archive"
3+
4+
# The org Actions policy allows GitHub-owned actions/* only (no Marketplace,
5+
# no verified creators), so third-party setup actions cannot be used here.
6+
# There is no actions/setup-flutter, so the SDK is installed inline.
7+
8+
inputs:
9+
flutter-version:
10+
description: "Flutter SDK version to install from the stable channel"
11+
required: false
12+
default: "3.29.2"
13+
sha256:
14+
description: "Expected SHA-256 of the Linux SDK archive. Empty skips verification."
15+
required: false
16+
default: ""
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: Restore Flutter SDK cache
22+
id: flutter-cache
23+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
24+
with:
25+
path: ${{ runner.tool_cache }}/flutter
26+
key: flutter-${{ runner.os }}-${{ runner.arch }}-${{ inputs.flutter-version }}
27+
28+
- name: Download Flutter SDK
29+
if: steps.flutter-cache.outputs.cache-hit != 'true'
30+
shell: bash
31+
env:
32+
FLUTTER_VERSION: ${{ inputs.flutter-version }}
33+
EXPECTED_SHA256: ${{ inputs.sha256 }}
34+
run: |
35+
set -euo pipefail
36+
37+
ARCHIVE="flutter_linux_${FLUTTER_VERSION}-stable.tar.xz"
38+
URL="https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/${ARCHIVE}"
39+
40+
echo "Downloading ${URL}"
41+
curl -fsSL --retry 3 --retry-delay 5 -o "${RUNNER_TEMP}/${ARCHIVE}" "${URL}"
42+
43+
if [ -n "${EXPECTED_SHA256}" ]; then
44+
echo "${EXPECTED_SHA256} ${RUNNER_TEMP}/${ARCHIVE}" | sha256sum -c -
45+
else
46+
echo "::warning::No sha256 supplied — skipping archive integrity check"
47+
fi
48+
49+
mkdir -p "${RUNNER_TOOL_CACHE}/flutter"
50+
tar -xJf "${RUNNER_TEMP}/${ARCHIVE}" -C "${RUNNER_TOOL_CACHE}/flutter" --strip-components=1
51+
rm -f "${RUNNER_TEMP}/${ARCHIVE}"
52+
53+
- name: Add Flutter to PATH
54+
shell: bash
55+
run: |
56+
set -euo pipefail
57+
echo "${RUNNER_TOOL_CACHE}/flutter/bin" >> "${GITHUB_PATH}"
58+
echo "${RUNNER_TOOL_CACHE}/flutter/bin/cache/dart-sdk/bin" >> "${GITHUB_PATH}"
59+
60+
- name: Verify Flutter toolchain
61+
shell: bash
62+
run: |
63+
set -euo pipefail
64+
# The SDK ships as a git checkout; the tool shells out to git against it.
65+
git config --global --add safe.directory "${RUNNER_TOOL_CACHE}/flutter"
66+
flutter --version

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ permissions:
1313

1414
env:
1515
ARTIFACTORY_URL: ${{ vars.ARTIFACTORY_URL }}
16+
FLUTTER_SUPPRESS_ANALYTICS: "true"
17+
FLUTTER_VERSION: "3.29.2"
1618

1719
jobs:
1820
test:
1921
name: Test - ${{ matrix.package }}
20-
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'ubuntu-x64' }}
22+
runs-on: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'ubuntu-latest-large' }}
2123
strategy:
2224
fail-fast: false
2325
matrix:
@@ -38,10 +40,11 @@ jobs:
3840
distribution: 'zulu'
3941
java-version: '17'
4042

41-
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2
43+
- name: Setup Flutter
44+
uses: ./.github/actions/setup-flutter
4245
with:
43-
channel: stable
44-
flutter-version: 3.29.2
46+
flutter-version: ${{ env.FLUTTER_VERSION }}
47+
sha256: 6096f21370773093ec19240e133664c1c12eb8b5a85605a92d16ce462a18eac4
4548

4649
- name: Authenticate with Artifactory
4750
if: ${{ !github.event.pull_request.head.repo.fork }}

‎.github/workflows/publish.yml‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ permissions:
1616

1717
env:
1818
ARTIFACTORY_URL: ${{ vars.ARTIFACTORY_URL }}
19+
FLUTTER_SUPPRESS_ANALYTICS: "true"
20+
FLUTTER_VERSION: "3.29.2"
1921

2022
jobs:
2123
test:
2224
name: Pre-publish tests
23-
runs-on: ubuntu-x64
25+
runs-on: ubuntu-latest-large
2426

2527
steps:
2628
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@@ -30,10 +32,11 @@ jobs:
3032
distribution: 'zulu'
3133
java-version: '17'
3234

33-
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2
35+
- name: Setup Flutter
36+
uses: ./.github/actions/setup-flutter
3437
with:
35-
channel: stable
36-
flutter-version: 3.29.2
38+
flutter-version: ${{ env.FLUTTER_VERSION }}
39+
sha256: 6096f21370773093ec19240e133664c1c12eb8b5a85605a92d16ce462a18eac4
3740

3841
- name: Authenticate with Artifactory
3942
uses: ./.github/actions/artifactory-oidc
@@ -48,17 +51,18 @@ jobs:
4851

4952
publish:
5053
name: Publish to pub.dev
51-
runs-on: ubuntu-x64
54+
runs-on: ubuntu-latest-large
5255
needs: [test]
5356
environment: production
5457

5558
steps:
5659
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
5760

58-
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2
61+
- name: Setup Flutter
62+
uses: ./.github/actions/setup-flutter
5963
with:
60-
channel: stable
61-
flutter-version: 3.29.2
64+
flutter-version: ${{ env.FLUTTER_VERSION }}
65+
sha256: 6096f21370773093ec19240e133664c1c12eb8b5a85605a92d16ce462a18eac4
6266

6367
- name: Publish to pub.dev (Trusted Publishing)
6468
run: dart pub publish --force

0 commit comments

Comments
 (0)