Skip to content

Commit

Permalink
👷 增加 CI
Browse files Browse the repository at this point in the history
  • Loading branch information
BytesZero committed Aug 4, 2024
1 parent 790f05e commit f1f237f
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Flutter CI

# This workflow is triggered on pushes to the repository.

on:
push:
branches:
- master

jobs:
build:
# This job will run on macos virtual machine
runs-on: macos-13
steps:

# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
# Setup the flutter environment.
- uses: subosito/flutter-action@v2
with:
channel: 'stable' # 'dev', 'alpha', default to: 'stable'
# flutter-version: '1.22.x' # you can also specify exact version of flutter

# Get flutter dependencies.
- run: flutter pub get

# Check for any formatting issues in the code.
- run: dart format --set-exit-if-changed .

# Statically analyze the Dart code for any errors.
- run: dart analyze .

#####
# Build app
#####
# Build apk.
- run: cd example && flutter build apk
# Build ios
- run: cd example && flutter build ios --no-codesign
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Extract version from tag
id: extract_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Read release notes
id: release_notes
run: |
VERSION=${{ env.VERSION }}
CHANGELOG=$(sed -n "/## $VERSION/,/^## /p" CHANGELOG.md | sed '$d' | tail -n +2)
if [ -z "$CHANGELOG" ]; then
echo "Release notes not found for version $VERSION"
exit 1
fi
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
body: ${{ env.RELEASE_NOTES }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
## 1.0.0

* 🚀 [仅提供 Pro 版本](https://flutterads.top/)
* 🎉 【独家支持】可 Widget 组件嵌入Flutter 页面
* 🎨 【独家支持】可自定义 UI 样式,与业务完美契合
Expand Down

0 comments on commit f1f237f

Please sign in to comment.