Skip to content

Update main.yml

Update main.yml #15

Workflow file for this run

name: "Build & Release"
on:
pull_request:
branches: main
push:
branches: main
jobs:
build:
name: Build & Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Up Java
uses: actions/setup-java@v3.12.0
with:
distribution: 'oracle'
java-version: '17'
- name: Set Up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.2'
channel: 'stable'
- name: Cache Flutter Dependencies
uses: actions/cache@v3
with:
path: ${{ runner.tool_cache }}/pub
key: ${{ runner.os }}-flutter-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-flutter-pub-
- name: Install Dependencies
run: flutter pub get
- name: Build APK
run: flutter build apk --release
- name: Extract Version and Generate Unique Tag
id: extract_version
run: |
version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
unique_tag="${version}-build-${{ github.run_number }}"
echo "VERSION=$version" >> $GITHUB_ENV
echo "UNIQUE_TAG=$unique_tag" >> $GITHUB_ENV
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/app-release.apk"
tag: v${{ env.UNIQUE_TAG }}
token: ${{ secrets.TOKEN }}
name: "Release v${{ env.UNIQUE_TAG }}"
body: "Rilis otomatis dari GitHub Actions"
- name: Push to jeketi-app Repository
uses: actions/checkout@v3
with:
repository: fskhri/jeketi-app
token: ${{ secrets.TOKEN }}