small theme changes #3
@@ -9,76 +9,15 @@ on:
|
|||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
actions: read
|
actions: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
calculate-version:
|
|
||||||
name: Calculate Version
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
new_version: ${{ steps.version.outputs.new_version }}
|
|
||||||
bump_type: ${{ steps.version.outputs.bump_type }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Get commit message and determine version bump
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
||||||
HEAD_REF="${{ github.head_ref }}"
|
|
||||||
echo "DEBUG: Commit message: '$COMMIT_MSG'"
|
|
||||||
echo "DEBUG: Head ref: '$HEAD_REF'"
|
|
||||||
|
|
||||||
if [[ $COMMIT_MSG == [fix]* ]]; then
|
|
||||||
BUMP_TYPE="patch"
|
|
||||||
elif [[ $COMMIT_MSG == [feature]* ]]; then
|
|
||||||
BUMP_TYPE="minor"
|
|
||||||
elif [[ $COMMIT_MSG == [release]* ]]; then
|
|
||||||
BUMP_TYPE="major"
|
|
||||||
elif [[ $HEAD_REF == fix/* ]]; then
|
|
||||||
BUMP_TYPE="patch"
|
|
||||||
elif [[ $HEAD_REF == feature/* ]] || [[ $HEAD_REF == feat/* ]]; then
|
|
||||||
BUMP_TYPE="minor"
|
|
||||||
elif [[ $HEAD_REF == release/* ]] || [[ $HEAD_REF == hotfix/* ]]; then
|
|
||||||
BUMP_TYPE="major"
|
|
||||||
else
|
|
||||||
BUMP_TYPE="none"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
|
||||||
LATEST_TAG=${LATEST_TAG#v}
|
|
||||||
|
|
||||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_TAG"
|
|
||||||
MAJOR=${MAJOR:-0}
|
|
||||||
MINOR=${MINOR:-0}
|
|
||||||
PATCH=${PATCH:-0}
|
|
||||||
|
|
||||||
if [ "$BUMP_TYPE" == "major" ]; then
|
|
||||||
((MAJOR++))
|
|
||||||
MINOR=0
|
|
||||||
PATCH=0
|
|
||||||
elif [ "$BUMP_TYPE" == "minor" ]; then
|
|
||||||
((MINOR++))
|
|
||||||
PATCH=0
|
|
||||||
elif [ "$BUMP_TYPE" == "patch" ]; then
|
|
||||||
((PATCH++))
|
|
||||||
fi
|
|
||||||
|
|
||||||
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
|
|
||||||
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
||||||
echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
build_apk:
|
build_apk:
|
||||||
name: Build Flutter APK
|
name: Build Flutter APK
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: calculate-version
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -94,68 +33,39 @@ jobs:
|
|||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
with:
|
with:
|
||||||
packages: "platform-tools platforms;android-36 build-tools;36.0.0"
|
packages: "platform-tools platforms;android-36 build-tools;36.0.0"
|
||||||
|
|
||||||
- name: Setup Flutter
|
- name: Setup Flutter
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
channel: stable
|
channel: stable
|
||||||
|
|
||||||
- run: flutter --version
|
- run: flutter --version
|
||||||
- run: flutter doctor
|
- run: flutter doctor
|
||||||
|
|
||||||
- name: Get dependencies
|
- name: Get dependencies
|
||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Update pubspec.yaml with new version
|
|
||||||
run: |
|
|
||||||
sed -i "s/^version: .*/version: ${{ needs.calculate-version.outputs.new_version }}+${{ github.run_number }}/" pubspec.yaml
|
|
||||||
cat pubspec.yaml | grep version
|
|
||||||
|
|
||||||
- name: Build APK
|
- name: Build APK
|
||||||
run: flutter build apk --release
|
run: flutter build apk --release
|
||||||
|
|
||||||
- name: Upload APK artifact
|
- name: Upload APK artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: flutter-apk
|
name: flutter-apk
|
||||||
path: build/app/outputs/flutter-apk/app-release.apk
|
path: build/app/outputs/flutter-apk/app-release.apk
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
create-release:
|
|
||||||
name: Create Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [calculate-version, build_apk]
|
|
||||||
if: needs.calculate-version.outputs.bump_type != 'none'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Download APK artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: flutter-apk
|
|
||||||
|
|
||||||
- name: Create Git tag
|
|
||||||
run: |
|
|
||||||
NEW_TAG="v${{ needs.calculate-version.outputs.new_version }}"
|
|
||||||
git config --local user.name "GitHub Actions"
|
|
||||||
git config --local user.email "actions@github.com"
|
|
||||||
git tag -a "$NEW_TAG" -m "Release ${{ needs.calculate-version.outputs.new_version }}"
|
|
||||||
git push origin "$NEW_TAG"
|
|
||||||
|
|
||||||
- name: Create Gitea release
|
- name: Create Gitea release
|
||||||
uses: akkuman/gitea-release-action@v1
|
uses: akkuman/gitea-release-action@v1
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.RUNNER_CREATE_RELEASE }}
|
GITEA_TOKEN: ${{ secrets.RUNNER_CREATE_RELEASE }}
|
||||||
with:
|
with:
|
||||||
tag_name: "v${{ needs.calculate-version.outputs.new_version }}"
|
tag_name: "v0.1.${{ github.run_number }}"
|
||||||
name: "Flutter Android v${{ needs.calculate-version.outputs.new_version }}"
|
name: "Flutter Android v0.1.${{ github.run_number }}"
|
||||||
body: "Automated build from CI\n\nVersion bump type: ${{ needs.calculate-version.outputs.bump_type }}"
|
body: "Automated build from CI"
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
files: |
|
files: |
|
||||||
build/app/outputs/flutter-apk/app-release.apk
|
build/app/outputs/flutter-apk/app-release.apk
|
||||||
gitea_url: "https://git.skup.in"
|
gitea_url: "https://git.skup.in"
|
||||||
owner: "marco"
|
owner: "marco"
|
||||||
repo: "maps_bookmarks"
|
repo: "maps_bookmarks"
|
||||||
Reference in New Issue
Block a user