Skip to content

Commit eab3cc4

Browse files
Update GitHub actions
1 parent 765325a commit eab3cc4

File tree

13 files changed

+752
-29
lines changed

13 files changed

+752
-29
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/dependabot.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

.github/workflows/release.yml

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
name: Build & Release
2+
3+
# Trigger on push to master branch or with a tag
4+
on:
5+
push:
6+
branches:
7+
- '**'
8+
tags:
9+
- 'V*'
10+
11+
# If previous workflow is still running, we push again, we will cancel the previous workflow
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref_name }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
Build:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- target: Android
23+
os: ubuntu-latest
24+
artifact_name: release-Android
25+
artifact_path: build/app/outputs/flutter-apk/*.apk
26+
- target: Windows
27+
os: windows-latest
28+
artifact_name: release-Windows
29+
artifact_path: |
30+
build/windows/outputs/*.zip
31+
build/windows/outputs/*.exe
32+
outputs:
33+
version: ${{ steps.get_version.outputs.version }}
34+
date: ${{ steps.get_version.outputs.date}}
35+
runs-on: ${{ matrix.os }}
36+
env:
37+
FLUTTER_VERSION: 3.24.0
38+
steps:
39+
# Checkout branch
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
# Add Android keystore
44+
- name: Setup Android keystore
45+
if: matrix.target == 'Android'
46+
run: |
47+
echo "${{ secrets.ENCODED_KEYSTORE }}" | base64 -di > android/app/cloudchewie.jks
48+
echo "${{ secrets.KEY_PROPERTIES }}" > android/key.properties
49+
50+
# Setup Flutter
51+
- name: Setup Flutter
52+
uses: subosito/flutter-action@v2.16.0
53+
with:
54+
flutter-version: ${{ env.FLUTTER_VERSION }}
55+
channel: 'stable'
56+
cache: true
57+
58+
# Setup JDK
59+
- name: Setup JDK 17 (Android)
60+
if: matrix.target == 'Android'
61+
uses: actions/setup-java@v4
62+
with:
63+
distribution: 'temurin'
64+
java-version: '17'
65+
cache: gradle
66+
67+
# Flutter Pub Get
68+
- name: Flutter Pub Get
69+
run: |
70+
git config --global core.longpaths true
71+
flutter doctor -v
72+
flutter pub get
73+
dart run intl_utils:generate
74+
75+
# Get app version
76+
- name: Get app version
77+
id: get_version
78+
shell: bash
79+
run: |
80+
echo "version=$(head -n 2 pubspec.yaml | tail -n 1 | cut -d ' ' -f 2 | cut -d '+' -f 1)" >> $GITHUB_OUTPUT
81+
echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
82+
83+
# Build Android .apk
84+
- name: Build Android
85+
if: matrix.target == 'Android'
86+
run: |
87+
flutter build apk --release
88+
flutter build apk --release --split-per-abi
89+
cd build/app/outputs/flutter-apk
90+
mv app-release.apk Loftify-${{ steps.get_version.outputs.version }}-android-universal.apk
91+
mv app-arm64-v8a-release.apk Loftify-${{ steps.get_version.outputs.version }}-android-arm64-v8a.apk
92+
mv app-armeabi-v7a-release.apk Loftify-${{ steps.get_version.outputs.version }}-android-armeabi-v7a.apk
93+
mv app-x86_64-release.apk Loftify-${{ steps.get_version.outputs.version }}-android-x86_64.apk
94+
95+
# Build Windows .zip
96+
- name: Build Windows
97+
if: matrix.target == 'Windows'
98+
run: |
99+
flutter build windows --release
100+
$DestDir = "build\windows\outputs\Loftify-${{ steps.get_version.outputs.version }}-windows-x86_64"
101+
$SrcDir = "build\windows\x64\runner\Release"
102+
$dllDir = "tools\windows_dll"
103+
104+
Copy-Item -Filter *.dll -Path $dllDir\* -Destination $SrcDir -Force
105+
New-Item -Path $DestDir -ItemType Directory
106+
Copy-Item $SrcDir\* -Recurse $DestDir
107+
108+
Compress-Archive $DestDir build\windows\outputs\Loftify-${{ steps.get_version.outputs.version }}-windows-x86_64.zip
109+
110+
(Get-Content tools/windows_tools/Loftify.iss) -replace '#define MyAppVersion ".*"', '#define MyAppVersion "${{ steps.get_version.outputs.version }}"' | Set-Content tools/windows_tools/Loftify.iss
111+
112+
# Build Windows .exe
113+
- name: Build Windows Installer
114+
if: matrix.target == 'Windows'
115+
uses: Minionguyjpro/Inno-Setup-Action@v1.2.5
116+
with:
117+
path: tools/windows_tools/Loftify.iss
118+
119+
# Upload Artifacts
120+
- name: Upload Artifacts
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: ${{ matrix.artifact_name }}
124+
path: ${{ matrix.artifact_path }}
125+
126+
Publish:
127+
if: startsWith(github.ref, 'refs/tags/')
128+
name: Publish
129+
needs: Build
130+
runs-on: ubuntu-latest
131+
steps:
132+
- name: Checkout
133+
uses: actions/checkout@v4
134+
- name: Get app version
135+
id: get_version
136+
shell: bash
137+
run: |
138+
echo "version=$(head -n 2 pubspec.yaml | tail -n 1 | cut -d ' ' -f 2 | cut -d '+' -f 1)" >> $GITHUB_OUTPUT
139+
- name: Make tmp dir
140+
run: mkdir /tmp/artifacts
141+
- name: Download all Artifacts
142+
uses: actions/download-artifact@v4
143+
with:
144+
path: /tmp/artifacts
145+
- name: List and move all Artifacts
146+
run: |
147+
mkdir -p /tmp/artifacts/final
148+
mv /tmp/artifacts/release-Android/*.apk /tmp/artifacts/final/
149+
mv /tmp/artifacts/release-Windows/*.zip /tmp/artifacts/final/
150+
mv /tmp/artifacts/release-Windows/*.exe /tmp/artifacts/final/
151+
152+
cd /tmp/artifacts/final
153+
for file in *; do
154+
if [ -f "$file" ]; then
155+
sha1sum "$file" | awk '{ print $1 }' > "$file.sha1"
156+
fi
157+
done
158+
ls -R /tmp/artifacts/final
159+
160+
- name: Upload to S3
161+
uses: Robert-Stackflow/upload-s3-action@master
162+
with:
163+
endpoint: ${{ secrets.AWS_ENDPOINT }}
164+
aws_key_id: ${{ secrets.AWS_KEY_ID }}
165+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
166+
aws_bucket: ${{ secrets.AWS_BUCKET }}
167+
source_dir: /tmp/artifacts/final
168+
destination_dir: Loftify/${{ steps.get_version.outputs.version }}
169+
- name: Upload to release
170+
uses: Robert-Stackflow/release-action@master
171+
with:
172+
tag: ${{ github.ref_name }}
173+
allowUpdates: true
174+
generateReleaseNotes: true
175+
artifacts: /tmp/artifacts/final/*
176+
artifactErrorsFailBuild: true
177+
replacesArtifacts: true
178+
makeLatest: true
179+
draft: true
180+
updateOnlyUnreleased: true

lib/Models/github_response.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ class ReleaseAsset {
129129
dynamic uploader;
130130
String url;
131131

132+
String? pkgsDownloadUrl;
133+
132134
ReleaseAsset({
133135
required this.browserDownloadUrl,
134136
required this.contentType,

lib/Utils/constant.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const minimumSize = Size(630, 700);
1818
const String shareText = "Loftify - 简洁的LOFTER第三方APP\n$officialWebsite";
1919
const String feedbackEmail = "2014027378@qq.com";
2020
const String feedbackSubject = "Loftify反馈";
21+
const windowsKeyPath = r'SOFTWARE\Cloudchewie\Loftify';
2122
const String feedbackBody = "";
23+
const String downloadPkgsUrl = "https://pkgs.cloudchewie.com/Loftify";
2224
const String officialWebsite = "https://apps.cloudchewie.com/loftify";
2325
const String telegramLink = "https://t.me/Loftify";
2426
const String repoUrl = "https://github.com/Robert-Stackflow/Loftify";

0 commit comments

Comments
 (0)