Skip to content

fix: Example configuration #29

fix: Example configuration

fix: Example configuration #29

name: Main workflow
on:
push:
branches:
- main
paths-ignore:
- '.gitignore'
- '.metadata'
- 'README.md'
- '.github/**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
jobs:
get_version:
name: Retrieve version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.split.outputs._0 }}
steps:
- uses: actions/checkout@v4
- name: Get the version from the pubspec
id: pubspecVersion
uses: CumulusDS/get-yaml-paths-action@v1.0.2
with:
file: pubspec.yaml
version: version
- uses: jungwinter/split@v2
id: split
with:
msg: ${{ steps.pubspecVersion.outputs.version }}
separator: '+'
tests:
name: Tests & checks
runs-on: ubuntu-latest
steps:
#### SETUP ####
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- run: flutter doctor
- name: Get dependencies
run: flutter pub get
- name: Generate files
run: |
flutter pub run build_runner build --delete-conflicting-outputs
flutter pub get # Temporary until https://github.com/flutter/flutter/issues/148333 is solved
### CHECKS ###
- name: Analyze code
run: flutter analyze
- name: Run tests
run: flutter test --coverage
create_release:
name: Create GitHub pre-release
needs:
- get_version
- tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create pre-release
run: |
gh release create pre-${{ needs.get_version.outputs.version }}+${{github.run_number}} --title v${{ needs.get_version.outputs.version }} -R '${{ github.repository }}' --prerelease --generate-notes