Version 0.0.4. #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Main Release | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| name: Tests, Build & Deploy | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Code Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get Pubspec Version | |
| run: | | |
| VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+') | |
| sed -i "s/dev/$VERSION/g" bin/check.dart | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Check if version is used | |
| run: | | |
| URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/${{ env.VERSION }} | |
| CODE=$(curl -s -H "Authorization: Bearer ${{ github.token }}" -o /dev/null -w "%{http_code}" "$URL") | |
| if [ "$CODE" != 404 ]; then | |
| echo "Release '$VERSION' already exists. ($CODE)" | |
| exit 1 | |
| fi | |
| - name: Flutter Environment | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: 'stable' | |
| cache: false | |
| - name: Install lcov | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt install -y lcov | |
| mkdir -p build | |
| - name: Dart Pub Get | |
| timeout-minutes: 3 | |
| run: dart pub get | |
| - name: Dart Test | |
| run: | | |
| dart test \ | |
| --coverage=coverage \ | |
| --concurrency=$(grep -c processor /proc/cpuinfo) | |
| - name: Dart Compile | |
| run: dart compile exe bin/check.dart -o build/check | |
| - 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 "check" \ | |
| --show-details | |
| - name: Creating package filter. | |
| run: dart run helpers/create_index.dart README.md coverage/html/index.html | |
| - name: Publishing to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| publish_dir: ./coverage/html | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| cname: check.testainers.com | |
| - name: Creating a GitHub Tag | |
| uses: mathieudutour/github-tag-action@v6.2 | |
| with: | |
| custom_tag: ${{ env.VERSION }} | |
| tag_prefix: '' | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create a GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ env.VERSION }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| allowUpdates: true | |
| artifacts: build/* |