Skip to content

git: added changelogs automation #30

git: added changelogs automation

git: added changelogs automation #30

Workflow file for this run

name: Build and Release AnymeX
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
generate-changelog:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
#!/bin/bash
PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -vE '(-alpha|-beta|-rc)' | head -n 2 | tail -n 1)
CURRENT_TAG=${GITHUB_REF#refs/tags/}
if [ -z "$PREVIOUS_TAG" ]; then
PREVIOUS_TAG=$(git rev-list --max-parents=0 HEAD)
fi
COMMITS=$(git log $PREVIOUS_TAG..$CURRENT_TAG --pretty=format:'* `%h`: %s')
echo "# Changelog" > CHANGELOG.md
echo "## $CURRENT_TAG" >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "$COMMITS" >> CHANGELOG.md
cat CHANGELOG.md
- name: Update Release with Changelog
uses: ncipollo/release-action@v1
with:
bodyFile: "CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
build-android:
runs-on: ubuntu-latest
needs: generate-changelog
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "17"
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
- name: Get Dependencies
run: flutter pub get
- name: Build Android with Split ABI
run: flutter build apk --split-per-abi
- name: Rename APKs
run: |
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build/app/outputs/flutter-apk/AnymeX-Android-armeabi-v7a.apk
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build/app/outputs/flutter-apk/AnymeX-Android-arm64.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk build/app/outputs/flutter-apk/AnymeX-Android-x86_64.apk
- name: Build Universal APK
run: flutter build apk --release
- name: Rename Universal APK
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/AnymeX-Android-universal.apk
- name: Release Android APKs
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/AnymeX-Android-*.apk"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: ${{ github.ref_name }}
build-ios:
runs-on: macos-latest
needs: generate-changelog
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
- name: Get Dependencies
run: flutter pub get
- name: Build iOS
run: |
flutter build ios --release --no-codesign
cd build/ios/iphoneos
mkdir -p Payload
cd Payload
ln -s ../Runner.app
cd ..
zip -r AnymeX-iOS-${{ github.ref_name }}.ipa Payload
mv AnymeX-iOS-${{ github.ref_name }}.ipa ../../../
- name: Release iOS IPA
uses: ncipollo/release-action@v1
with:
artifacts: "AnymeX-iOS-*.ipa"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: ${{ github.ref_name }}
build-linux:
runs-on: ubuntu-latest
needs: generate-changelog
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build cmake g++ libgtk-3-dev libblkid-dev liblzma-dev pkg-config libmpv-dev libwebkit2gtk-4.1-dev
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
- name: Replace pubspec.yaml with Desktop Version
run: cp pubspec_desktop.yaml pubspec.yaml
- name: Get Dependencies
run: flutter pub get
- name: Build Linux
run: flutter build linux --release
- name: Zip Linux Artifacts
run: |
cd build/linux/x64/release/bundle
zip -r ../../../../../AnymeX-Linux.zip .
- name: Release Linux Build
uses: ncipollo/release-action@v1
with:
artifacts: "AnymeX-Linux.zip"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: ${{ github.ref_name }}
build-windows:
runs-on: windows-latest
needs: generate-changelog
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
- name: Replace pubspec.yaml with Desktop Version
run: Copy-Item -Path pubspec_desktop.yaml -Destination pubspec.yaml -Force
- name: Get Dependencies
run: flutter pub get
- name: Build Windows
run: flutter build windows --release
- name: Create ZIP file for Windows Build
run: |
cd build/windows/x64/runner/Release
Compress-Archive -Path * -DestinationPath AnymeX-Windows.zip
- name: Setup Inno Setup
run: choco install innosetup -y
- name: Build Installer with Inno Setup
run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" inno.iss
- name: Release Windows Builds
uses: ncipollo/release-action@v1
with:
artifacts: "build/windows/x64/runner/Release/AnymeX-Windows.zip,output/AnymeX-Setup.exe"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: ${{ github.ref_name }}