From 6d699c85bc9978107e11e81597559d8cd45124fc Mon Sep 17 00:00:00 2001 From: CDN18 Date: Sun, 10 Dec 2023 16:43:08 +0800 Subject: [PATCH 1/5] ci: Deploy to Cloudflare Pages --- .github/workflows/wrangler.yaml | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/wrangler.yaml diff --git a/.github/workflows/wrangler.yaml b/.github/workflows/wrangler.yaml new file mode 100644 index 0000000000..c97b698faf --- /dev/null +++ b/.github/workflows/wrangler.yaml @@ -0,0 +1,35 @@ +name: Wrangler + +on: + push: + branches: + - main + +jobs: + deploy_web: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + - run: flutter pub get + - name: Prepare web + run: ./scripts/prepare-web.sh + - name: Build Release Web + run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/web/" + - name: Prepare config + run: | + cp config.sample.json config.json + sed -i 's/matrix.org/mtx.codeword.info/g' config.json + sed -i 's/fluffychat.im\/web/fluffy.codeword.info/g' config.json + mv config.json build/web/config.json + - name: Deploy to Cloudflare Pages + uses: cloudflare/pages-action@v1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} + directory: build/web From cc58f3e4353ca96dca324d658c575cb1f6e1a6d5 Mon Sep 17 00:00:00 2001 From: CDN18 Date: Sun, 10 Dec 2023 17:14:05 +0800 Subject: [PATCH 2/5] ci: build config --- .github/workflows/wrangler.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wrangler.yaml b/.github/workflows/wrangler.yaml index c97b698faf..7af660fb1f 100644 --- a/.github/workflows/wrangler.yaml +++ b/.github/workflows/wrangler.yaml @@ -16,16 +16,15 @@ jobs: flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - run: flutter pub get - - name: Prepare web - run: ./scripts/prepare-web.sh - - name: Build Release Web - run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/web/" - name: Prepare config run: | cp config.sample.json config.json sed -i 's/matrix.org/mtx.codeword.info/g' config.json sed -i 's/fluffychat.im\/web/fluffy.codeword.info/g' config.json - mv config.json build/web/config.json + - name: Prepare web + run: ./scripts/prepare-web.sh + - name: Build Release Web + run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/web/" - name: Deploy to Cloudflare Pages uses: cloudflare/pages-action@v1 with: From 8bb69c74e7c1873f98ad94eb25608432010a3952 Mon Sep 17 00:00:00 2001 From: CDN18 Date: Sun, 10 Dec 2023 20:07:12 +0800 Subject: [PATCH 3/5] ci: no base-href --- .github/workflows/wrangler.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wrangler.yaml b/.github/workflows/wrangler.yaml index 7af660fb1f..697bcb11ad 100644 --- a/.github/workflows/wrangler.yaml +++ b/.github/workflows/wrangler.yaml @@ -24,7 +24,7 @@ jobs: - name: Prepare web run: ./scripts/prepare-web.sh - name: Build Release Web - run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/web/" + run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps - name: Deploy to Cloudflare Pages uses: cloudflare/pages-action@v1 with: From 7f61f35b4bce5b37e9b503cf5a3eada5d9d4648c Mon Sep 17 00:00:00 2001 From: CDN18 Date: Sun, 10 Dec 2023 22:37:56 +0800 Subject: [PATCH 4/5] ci: desktop build --- .github/workflows/desktop.yaml | 74 ++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/desktop.yaml diff --git a/.github/workflows/desktop.yaml b/.github/workflows/desktop.yaml new file mode 100644 index 0000000000..2add8a735d --- /dev/null +++ b/.github/workflows/desktop.yaml @@ -0,0 +1,74 @@ +name: Build Desktop + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + linux: + name: Linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 -y + - run: flutter pub get + - run: flutter build linux --release --target-platform linux-x64 + - name: Create archive + run: tar -czf fluffychat-linux-x64.tar.gz -C build/linux/x64/release/bundle/ . + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: fluffychat-linux-x64 + path: fluffychat-linux-x64.tar.gz + + windows: + name: Windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + - name: Install dependencies + run: choco install -y ninja cmake + - run: flutter pub get + - run: flutter build windows --release --target-platform windows-x64 + - name: Create archive + run: 7z a fluffychat-windows-x64.zip build\windows\x64\release\bundle + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: fluffychat-windows-x64 + path: fluffychat-windows-x64.zip + + macos: + name: macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + - name: Install dependencies + run: brew install ninja cmake + - run: flutter pub get + - run: flutter build macos --release --target-platform darwin-x64 + - name: Create archive + run: tar -czf fluffychat-macos-x64.tar.gz -C build/macos/Build/Products/Release/ . + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: fluffychat-macos-x64 + path: fluffychat-macos-x64.tar.gz From 1d5639fcaf445b6e76948ddf344e5f384c422cbe Mon Sep 17 00:00:00 2001 From: CDN18 Date: Sun, 10 Dec 2023 22:42:29 +0800 Subject: [PATCH 5/5] ci: disable --target platform on windows/macOS builds --- .github/workflows/desktop.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/desktop.yaml b/.github/workflows/desktop.yaml index 2add8a735d..4d356fa4d2 100644 --- a/.github/workflows/desktop.yaml +++ b/.github/workflows/desktop.yaml @@ -42,7 +42,7 @@ jobs: - name: Install dependencies run: choco install -y ninja cmake - run: flutter pub get - - run: flutter build windows --release --target-platform windows-x64 + - run: flutter build windows --release - name: Create archive run: 7z a fluffychat-windows-x64.zip build\windows\x64\release\bundle - name: Upload artifact @@ -64,7 +64,7 @@ jobs: - name: Install dependencies run: brew install ninja cmake - run: flutter pub get - - run: flutter build macos --release --target-platform darwin-x64 + - run: flutter build macos --release - name: Create archive run: tar -czf fluffychat-macos-x64.tar.gz -C build/macos/Build/Products/Release/ . - name: Upload artifact