Skip to content

Merge pull request #15 from edufolly/dev #10

Merge pull request #15 from edufolly/dev

Merge pull request #15 from edufolly/dev #10

Workflow file for this run

name: Main Release
on:
push:
branches: [ main ]
jobs:
########
# Boot #
########
boot:
name: Boot
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
version: ${{ steps.version-step.outputs.version }}
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Get Pubspec Version
id: version-step
run: |
export VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if version is used
run: |
URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest
LATEST=$(curl --silent "$URL" | jq -r .name)
if [ "$LATEST" == "v$VERSION" ]; then
echo "Version already used: $VERSION"
exit 1
fi
###################
# Tests & Release #
###################
tests:
name: Tests & Release
needs: [ boot ]
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: Install lcov
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update -y
sudo apt install -y lcov
- name: Dart Pub Get
timeout-minutes: 3
run: dart pub get
- name: Dart Test
run: dart test --coverage=coverage
- name: Creating package filter.
run: dart run helpers/package.dart
- name: Creating lcov.info
run: |
dart run coverage:format_coverage \
--packages=coverage/package.json \
--lcov \
-i coverage \
-o coverage/lcov.info
- name: Creating Test Coverage HTML
run: |
genhtml coverage/lcov.info \
--output-directory coverage/html/coverage \
--title "curt" \
--show-details
- name: Creating package filter.
run: dart run helpers/create_index.dart README.md coverage/html/index.html
- name: Publish Dart Package
uses: k-paxian/[email protected]
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
skipTests: true
format: true
- name: Publishing to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: ./coverage/html
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Creating a GitHub Tag
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ needs.boot.outputs.version }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v${{ needs.boot.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}