|
| 1 | +name: Main Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ main ] |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + name: Tests, Build & Deploy |
| 9 | + runs-on: ubuntu-latest |
| 10 | + timeout-minutes: 20 |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + steps: |
| 14 | + - name: Code Checkout |
| 15 | + uses: actions/checkout@v6 |
| 16 | + |
| 17 | + - name: Get Pubspec Version |
| 18 | + run: | |
| 19 | + VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+') |
| 20 | + echo "VERSION=$VERSION" >> $GITHUB_ENV |
| 21 | +
|
| 22 | + - name: Check if version is used |
| 23 | + run: | |
| 24 | + URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/v${{ env.VERSION }} |
| 25 | + CODE=$(curl -s -H "Authorization: Bearer ${{ github.token }}" -o /dev/null -w "%{http_code}" "$URL") |
| 26 | + if [ "$CODE" != 404 ]; then |
| 27 | + echo "Release '$VERSION' already exists. ($CODE)" |
| 28 | + exit 1 |
| 29 | + fi |
| 30 | +
|
| 31 | + - name: Flutter Environment |
| 32 | + uses: subosito/flutter-action@v2 |
| 33 | + with: |
| 34 | + channel: 'stable' |
| 35 | + cache: false |
| 36 | + |
| 37 | +# - name: Install lcov |
| 38 | +# env: |
| 39 | +# DEBIAN_FRONTEND: noninteractive |
| 40 | +# run: | |
| 41 | +# sudo apt-get update -y |
| 42 | +# sudo apt install -y lcov |
| 43 | +# mkdir -p build |
| 44 | + |
| 45 | + - name: Dart Pub Get |
| 46 | + timeout-minutes: 3 |
| 47 | + run: dart pub get |
| 48 | + |
| 49 | +# - name: Dart Test |
| 50 | +# run: | |
| 51 | +# dart test \ |
| 52 | +# --coverage=coverage \ |
| 53 | +# --concurrency=$(grep -c processor /proc/cpuinfo) |
| 54 | + |
| 55 | + - name: Dart Compile |
| 56 | + run: | |
| 57 | + mkdir -p build |
| 58 | + dart compile exe bin/gitmoji.dart -o build/gitmoji |
| 59 | +
|
| 60 | +# - name: Creating package filter. |
| 61 | +# run: dart run helpers/package.dart |
| 62 | + |
| 63 | +# - name: Creating lcov.info |
| 64 | +# run: | |
| 65 | +# dart run coverage:format_coverage \ |
| 66 | +# --packages=coverage/package.json \ |
| 67 | +# --lcov \ |
| 68 | +# -i coverage \ |
| 69 | +# -o coverage/lcov.info |
| 70 | + |
| 71 | +# - name: Creating Test Coverage HTML |
| 72 | +# run: | |
| 73 | +# genhtml coverage/lcov.info \ |
| 74 | +# --output-directory coverage/html/coverage \ |
| 75 | +# --title "check" \ |
| 76 | +# --show-details |
| 77 | + |
| 78 | +# - name: Creating package filter. |
| 79 | +# run: dart run helpers/create_index.dart README.md coverage/html/index.html |
| 80 | + |
| 81 | +# - name: Publishing to GitHub Pages |
| 82 | +# uses: peaceiris/actions-gh-pages@v4 |
| 83 | +# with: |
| 84 | +# publish_dir: ./coverage/html |
| 85 | +# github_token: ${{ secrets.GITHUB_TOKEN }} |
| 86 | +# cname: check.testainers.com |
| 87 | + |
| 88 | + - name: Creating a GitHub Tag |
| 89 | + uses: mathieudutour/github-tag-action@v6.2 |
| 90 | + with: |
| 91 | + custom_tag: ${{ env.VERSION }} |
| 92 | + tag_prefix: '' |
| 93 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 94 | + |
| 95 | + - name: Create a GitHub Release |
| 96 | + uses: ncipollo/release-action@v1 |
| 97 | + with: |
| 98 | + tag: ${{ env.VERSION }} |
| 99 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + allowUpdates: true |
| 101 | + artifacts: build/* |
0 commit comments