Browse Source

Merge pull request #915 from nextcloud/refactor/ci/flutter-version

refactor(ci,tool): Simply flutter version extraction
pull/916/head
Kate 1 year ago committed by GitHub
parent
commit
d05e060536
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      .github/workflows/publish.yaml
  2. 7
      tool/build-app.sh

11
.github/workflows/publish.yaml

@ -23,9 +23,6 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Set flutter version
id: flutter_version
run: echo "FLUTTER_VERSION=$(jq ".flutterSdkVersion" -r < .fvm/fvm_config.json | cut -d "@" -f 1)" >> $GITHUB_OUTPUT
- name: Set build number - name: Set build number
id: build_number id: build_number
run: echo "BUILD_NUMBER=$(date +"%s")" >> $GITHUB_OUTPUT run: echo "BUILD_NUMBER=$(date +"%s")" >> $GITHUB_OUTPUT
@ -37,10 +34,12 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: kuhnroyal/flutter-fvm-config-action@v1
id: fvm_config
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # v2 - uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # v2
with: with:
flutter-version: ${{ needs.setup.outputs.flutter_version }} flutter-version: ${{ steps.fvm_config.outputs.FLUTTER_VERSION }}
channel: 'stable' channel: ${{ steps.fvm_config.outputs.FLUTTER_CHANNEL }}
cache: true cache: true
- name: Pub dependency cache - name: Pub dependency cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
@ -137,8 +136,6 @@ jobs:
platforms: linux/${{ matrix.architecture.docker }} platforms: linux/${{ matrix.architecture.docker }}
- name: Build - name: Build
env:
FLUTTER_VERSION: ${{ needs.setup.outputs.flutter_version }}
run: ./tool/build-app.sh linux/${{ matrix.architecture.docker }} --build-number="${{ needs.setup.outputs.build_number }}" run: ./tool/build-app.sh linux/${{ matrix.architecture.docker }} --build-number="${{ needs.setup.outputs.build_number }}"
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3

7
tool/build-app.sh

@ -13,11 +13,6 @@ if ! [[ ${targets[*]} =~ "$target" ]]; then
exit 1 exit 1
fi fi
if [ ! -v FLUTTER_VERSION ]; then
# shellcheck disable=SC2155
export FLUTTER_VERSION="$(jq ".flutterSdkVersion" -r < .fvm/fvm_config.json | cut -d "@" -f 1)"
fi
if [[ "$target" == "linux/arm64" ]] || [[ "$target" == "linux/amd64" ]]; then if [[ "$target" == "linux/arm64" ]] || [[ "$target" == "linux/amd64" ]]; then
os="$(echo "$target" | cut -d "/" -f 1)" os="$(echo "$target" | cut -d "/" -f 1)"
arch="$(echo "$target" | cut -d "/" -f 2)" arch="$(echo "$target" | cut -d "/" -f 2)"
@ -29,7 +24,7 @@ if [[ "$target" == "linux/arm64" ]] || [[ "$target" == "linux/amd64" ]]; then
--platform "$target" \ --platform "$target" \
--progress plain \ --progress plain \
--tag "$tag" \ --tag "$tag" \
--build-arg="FLUTTER_VERSION=$FLUTTER_VERSION" \ --build-arg="FLUTTER_VERSION=$(jq ".flutterSdkVersion" -r < .fvm/fvm_config.json | cut -d "@" -f 1)" \
$(cache_build_args "$tag") \ $(cache_build_args "$tag") \
-f "tool/build/Dockerfile.$os" \ -f "tool/build/Dockerfile.$os" \
./tool/build ./tool/build

Loading…
Cancel
Save