mirror of
https://github.com/Ujwal223/FocusGram.git
synced 2026-07-04 10:17:52 +02:00
Compare commits
3 Commits
backup-rewrite
...
v2.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| f1bd12f0bd | |||
| 7d13ad64f1 | |||
| 5f86441675 |
@@ -0,0 +1,10 @@
|
|||||||
|
import os, re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
version = os.environ["VERSION"]
|
||||||
|
text = Path("CHANGELOG.md").read_text(encoding="utf-8")
|
||||||
|
pattern = rf"(?ms)^##\s+FocusGram\s+{re.escape(version)}\s*$.*?(?=^##\s+|\Z)"
|
||||||
|
m = re.search(pattern, text)
|
||||||
|
if not m:
|
||||||
|
raise SystemExit(f"Could not find changelog section for version {version}")
|
||||||
|
Path("release_notes.md").write_text(m.group(0).strip() + "\n", encoding="utf-8")
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
|
||||||
|
text = Path("CHANGELOG.md").read_text(encoding="utf-8")
|
||||||
|
m = re.search(r"^##\s+FocusGram\s+([0-9]+\.[0-9]+\.[0-9]+)\s*$", text, re.M)
|
||||||
|
if not m:
|
||||||
|
raise SystemExit("Could not find a top changelog heading like: ## FocusGram 2.0.0")
|
||||||
|
print(m.group(1))
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
name: Build APK and Create GitHub Release
|
name: Build APK and Create GitHub Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
@@ -7,35 +6,28 @@ on:
|
|||||||
description: "Release version without leading v. Example: 1.0.0. Leave empty to read the top CHANGELOG heading."
|
description: "Release version without leading v. Example: 1.0.0. Leave empty to read the top CHANGELOG heading."
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5.0.0
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Java 17
|
- name: Set up Java 17
|
||||||
uses: actions/setup-java@v5.2.0
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: "17"
|
java-version: "17"
|
||||||
|
|
||||||
- name: Set up Android SDK
|
- name: Set up Android SDK
|
||||||
uses: android-actions/setup-android@v4.0.1
|
uses: android-actions/setup-android@v4
|
||||||
|
|
||||||
- name: Set up Flutter
|
- name: Set up Flutter
|
||||||
uses: subosito/flutter-action@v2.23.0
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
channel: stable
|
channel: stable
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Install required Android SDK packages
|
- name: Install required Android SDK packages
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -45,98 +37,58 @@ jobs:
|
|||||||
"platforms;android-35" \
|
"platforms;android-35" \
|
||||||
"build-tools;34.0.0" \
|
"build-tools;34.0.0" \
|
||||||
"build-tools;35.0.0" \
|
"build-tools;35.0.0" \
|
||||||
"ndk;28.2.12676356"
|
|
||||||
|
|
||||||
- name: Get dependencies
|
- name: Get dependencies
|
||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Resolve version and tag
|
- name: Resolve version and tag
|
||||||
id: meta
|
id: meta
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
INPUT_VERSION="${{ github.event.inputs.version }}"
|
INPUT_VERSION="${{ github.event.inputs.version }}"
|
||||||
|
|
||||||
if [[ -n "${INPUT_VERSION}" ]]; then
|
if [[ -n "${INPUT_VERSION}" ]]; then
|
||||||
VERSION="${INPUT_VERSION#v}"
|
VERSION="${INPUT_VERSION#v}"
|
||||||
else
|
else
|
||||||
VERSION="$(python3 - <<'PY'
|
VERSION="$(python3 .github/scripts/get_version.py)"
|
||||||
from pathlib import Path
|
|
||||||
import re
|
|
||||||
|
|
||||||
text = Path("CHANGELOG.md").read_text(encoding="utf-8")
|
|
||||||
m = re.search(r'^##\s+FocusGram\s+([0-9]+\.[0-9]+\.[0-9]+)\s*$', text, re.M)
|
|
||||||
if not m:
|
|
||||||
raise SystemExit("Could not find a top changelog heading like: ## FocusGram 2.0.0")
|
|
||||||
print(m.group(1))
|
|
||||||
PY
|
|
||||||
)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TAG="v${VERSION}"
|
TAG="v${VERSION}"
|
||||||
|
|
||||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Extract release notes from CHANGELOG.md
|
- name: Extract release notes from CHANGELOG.md
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ steps.meta.outputs.version }}
|
VERSION: ${{ steps.meta.outputs.version }}
|
||||||
run: |
|
run: python3 .github/scripts/get_notes.py
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
python3 - <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
version = os.environ["VERSION"]
|
|
||||||
text = Path("CHANGELOG.md").read_text(encoding="utf-8")
|
|
||||||
|
|
||||||
pattern = rf'(?ms)^##\s+FocusGram\s+{re.escape(version)}\s*$.*?(?=^##\s+|\Z)'
|
|
||||||
m = re.search(pattern, text)
|
|
||||||
if not m:
|
|
||||||
raise SystemExit(f"Could not find changelog section for version {version}")
|
|
||||||
|
|
||||||
Path("release_notes.md").write_text(m.group(0).strip() + "\n", encoding="utf-8")
|
|
||||||
PY
|
|
||||||
|
|
||||||
- name: Build release APK
|
- name: Build release APK
|
||||||
run: flutter build apk --release
|
run: flutter build apk --release
|
||||||
|
- name: Rename APK
|
||||||
|
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/focusgram-release.apk
|
||||||
- name: Upload APK artifact
|
- name: Upload APK artifact
|
||||||
uses: actions/upload-artifact@v7.0.1
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: focusgram-apk-${{ steps.meta.outputs.tag }}
|
name: focusgram-apk-${{ steps.meta.outputs.tag }}
|
||||||
path: build/app/outputs/flutter-apk/app-release.apk
|
path: build/app/outputs/flutter-apk/focusgram-release.apk
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Create Git tag
|
- name: Create Git tag
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
TAG: ${{ steps.meta.outputs.tag }}
|
TAG: ${{ steps.meta.outputs.tag }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
|
if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
|
||||||
echo "Tag already exists on remote: ${TAG}"
|
echo "Tag already exists on remote: ${TAG}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git tag -a "${TAG}" -m "Release ${TAG}"
|
git tag -a "${TAG}" -m "Release ${TAG}"
|
||||||
git push origin "${TAG}"
|
git push origin "${TAG}"
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
uses: softprops/action-gh-release@v3.0.0
|
uses: softprops/action-gh-release@v3
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.meta.outputs.tag }}
|
tag_name: ${{ steps.meta.outputs.tag }}
|
||||||
name: FocusGram ${{ steps.meta.outputs.tag }}
|
name: FocusGram ${{ steps.meta.outputs.tag }}
|
||||||
body_path: release_notes.md
|
body_path: release_notes.md
|
||||||
files: build/app/outputs/flutter-apk/app-release.apk
|
files: build/app/outputs/flutter-apk/focusgram-release.apk
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user