diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 18b2557..a377d4d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @benken @thelukewalton @mikecoomber #@ps9310 \ No newline at end of file +* @benken @thelukewalton @mikecoomber @ps9310 \ No newline at end of file diff --git a/.github/workflows/on-main.yml b/.github/workflows/on-main.yml index b0e9037..cd1b743 100644 --- a/.github/workflows/on-main.yml +++ b/.github/workflows/on-main.yml @@ -1,4 +1,4 @@ -name: release-please +name: CI - On Main on: push: branches: @@ -12,10 +12,10 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: google-github-actions/release-please-action@v4 + - uses: googleapis/release-please-action@v4 with: token: ${{ secrets.PAT }} - config-file: release-please-config.json + code-quality: runs-on: ubuntu-latest timeout-minutes: 20 @@ -41,4 +41,4 @@ jobs: git config --global user.email "github-actions@github.com" git add -A git commit -m '[automated commit] lint format and import sort' - git push -f \ No newline at end of file + git push -f diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index ab23f5c..0d150cf 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -1,4 +1,4 @@ -name: "CI - Release" +name: CI - On Release on: push: tags: @@ -15,23 +15,26 @@ jobs: - uses: dart-lang/setup-dart@v1 - name: Install Flutter uses: subosito/flutter-action@v2 + with: + cache: true - name: Install dependencies run: flutter pub get - name: Format code - run: | - dart format --fix . - dart fix --apply + run: dart format --fix . # TODO: Package uses pre-release packages, so this always fails. # - name: Check Publish Warnings # run: dart pub publish --dry-run - name: Publish run: dart pub publish --force + deploy: name: Deploy the example app on firebase runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 + with: + cache: true - name: Setup flutter run: flutter pub get - name: Build example app diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3ca3f4b..ab771f5 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -8,55 +8,49 @@ concurrency: cancel-in-progress: true jobs: - set-env: - name: "Set environment" - runs-on: ubuntu-latest - outputs: - env: ${{ steps.get_env.outputs.env }} - steps: - - uses: actions/checkout@v4 - with: - repository: ${{github.event.pull_request.head.repo.full_name}} - ref: ${{ github.head_ref }} - - name: Determine Environment - id: get_env - run: | - codeowners=$(cat .github/CODEOWNERS) - if [[ $(echo "${codeowners[@]}" | fgrep -w "@${{github.actor}}") ]]; then - echo PROWNER - echo "env=pr_owner" >> $GITHUB_OUTPUT - else - echo PR - echo "env=pr" >> $GITHUB_OUTPUT - fi code-quality: - name: Code quality runs-on: ubuntu-latest - timeout-minutes: 20 - needs: set-env - environment: ${{needs.set-env.outputs.env}} steps: - uses: actions/checkout@v4 with: repository: ${{github.event.pull_request.head.repo.full_name}} ref: ${{ github.head_ref }} + fetch-depth: 0 - uses: subosito/flutter-action@v2 with: cache: true - - - uses: ZebraDevs/flutter-code-quality@v1.0.4 + - run: dart run build_runner build --delete-conflicting-outputs + - uses: ZebraDevs/flutter-code-quality@main with: token: ${{secrets.GITHUB_TOKEN}} - run-tests: false - run-coverage: false + coverage-pass-score: "80" + + check-secret: + runs-on: ubuntu-latest + outputs: + secret-exists: ${{ steps.check.outputs.defined }} + steps: + - name: Check PR can access secrets + id: check + run: | + echo "defined=true" >> $GITHUB_OUTPUT; + if [ "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZETA_DS }}" == '' ]; then + echo "defined=false" >> $GITHUB_OUTPUT; + fi deploy-preview: - name: Deploy preview version of the example app on firebase - needs: code-quality + name: Deploy preview version of the storybook on firebase + needs: [code-quality, check-secret] + if: needs.check-secret.outputs.secret-exists == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + repository: ${{github.event.pull_request.head.repo.full_name}} + ref: ${{ github.head_ref }} - uses: subosito/flutter-action@v2 + with: + cache: true - name: Setup flutter run: flutter pub get - name: Build example app @@ -67,6 +61,4 @@ jobs: with: repoToken: "${{ secrets.GITHUB_TOKEN }}" firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZDS_FLUTTER }}" - expires: 7d - projectId: zds-c9c24 channelId: "pr-${{ github.event.number }}-${{ github.event.pull_request.head.ref }}"