chore: add pub release job

This commit is contained in:
td 2023-07-19 18:25:30 +05:30
parent 4bbb1fbba7
commit 427be0e0b8
No known key found for this signature in database
GPG Key ID: F6D9E9BF14C7D103
2 changed files with 48 additions and 6 deletions

View File

@ -36,6 +36,8 @@ jobs:
scripts/prepare.sh
scripts/test_driver.sh"
# coverage is done on the flutter image because we setup olm there
# coverage_without_olm is done on dart images because why not :D
coverage:
runs-on: ubuntu-latest
container:
@ -44,7 +46,7 @@ jobs:
- uses: actions/checkout@v3
- name: Run tests
run: |
sed -i 's/#\([^ ]\)/\1/g' pubspec.yaml
sed -i 's/#flutter_test/flutter_test/g' pubspec.yaml
rm -r example
./scripts/prepare.sh
./scripts/test.sh
@ -70,7 +72,27 @@ jobs:
image: dart:${{inputs.dart_version}}
steps:
- uses: actions/checkout@v3
- name: Run tests
- name: pub.dev publish dry run
run: |
dart pub get
dart pub publish --dry-run
pub-dev:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
container:
image: dart:${{inputs.dart_version}}
steps:
- uses: actions/checkout@v3
- name: pub.dev publish
run: |
if [ -z ${{ secrets.PUB_DEV_CREDENTIALS }}" ]; then
echo "Missing PUB_DEV_CREDENTIALS environment variable"
exit 1
fi
mkdir -p ~/.config/dart/
cp "${{ secrets.PUB_DEV_CREDENTIALS }}" ~/.config/dart/pub-credentials.json
dart pub get
dart pub publish --force

View File

@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
merge_group:
@ -11,14 +13,31 @@ concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
FLUTTER_VERSION: 3.10.6
DART_VERSION: 3.0.6
jobs:
# because there is no easy way to pass env variables to jobs
versions:
runs-on: ubuntu-latest
outputs:
flutter_version: ${{ steps.flutterver.outputs.FLUTTER_VERSION }}
dart_version: ${{ steps.dartver.outputs.DART_VERSION }}
steps:
- id: flutterver
run: echo "FLUTTER_VERSION=${{ env.FLUTTER_VERSION }}" >> "$GITHUB_OUTPUT"
- id: dartver
run: echo "DART_VERSION=${{ env.DART_VERSION }}" >> "$GITHUB_OUTPUT"
dart:
permissions:
contents: read
uses: famedly/frontend-ci-templates/.github/workflows/dart.yml@main
needs: [versions]
with:
flutter_version: 3.10.4
dart_version: 3.0.0
flutter_version: ${{ needs.versions.outputs.flutter_version }}
dart_version: ${{ needs.versions.outputs.dart_version }}
secrets:
ssh_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}"
@ -30,6 +49,7 @@ jobs:
app_jobs:
secrets: inherit
uses: ./.github/workflows/app.yml
needs: [versions]
with:
flutter_version: 3.10.4
dart_version: 3.0.3
flutter_version: ${{ needs.versions.outputs.flutter_version }}
dart_version: ${{ needs.versions.outputs.dart_version }}