From c7d2952fadca426846cd0f53e8822da432876a20 Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 3 Jan 2024 14:33:07 +0000 Subject: [PATCH] actions --- .github/workflows/merge.yml | 64 +++++++++++++---------------------- .github/workflows/pr.yml | 4 +-- .github/workflows/release.yml | 31 +++++++++++++++++ lib/zds_flutter.dart | 2 +- 4 files changed, 58 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index f1c2019..32a0cd1 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,34 +1,37 @@ name: "Merge" on: + push: + # TODO: Remove pull_request: types: [closed] + branches: + - main jobs: changes: runs-on: ubuntu-latest timeout-minutes: 5 - if: github.event.pull_request.merged + outputs: + any_changed: ${{ steps.changed-files.outputs.any_changed }} + # if: github.event.pull_request.mergedTODO: steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get all changed *.dart, files in docs or pubspec.yaml id: changed-files - uses: tj-actions/changed-files@v37 - with: - base_sha: ${{ github.event.pull_request.base.sha }} - sha: ${{ github.event.pull_request.head.sha }} - files: | - **/*.dart - pubspec.yaml - merge: + uses: tj-actions/changed-files@v41 + - name: test + run: | + echo ${{steps.changed-files.outputs.any_changed}} + bump_and_tag: runs-on: ubuntu-latest timeout-minutes: 20 needs: changes - if: needs.changes.outputs.files == 'true' + if: needs.changes.outputs.any_changed == 'true' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.head_ref }} @@ -39,14 +42,6 @@ jobs: - name: Change flutter version tag run: | echo "FLUTTER_BUILD_VERSION=$(cider bump patch --bump-build)" >> "$GITHUB_ENV" - - name: Update CHANGELOG - id: changelog - uses: requarks/changelog-action@v1 - with: - token: ${{ secrets.PAT }} - tag: ${{ steps.read-version.outputs.version-number }} - excludeTypes: "" - includeInvalidCommits: true - name: Update id: update run: | @@ -66,6 +61,15 @@ jobs: ref: 'refs/tags/${{env.FLUTTER_BUILD_VERSION}}', sha: "${{env.newSha}}" }) + + - name: Update CHANGELOG + id: changelog + uses: requarks/changelog-action@v1 + with:— + token: ${{ github.token }} + tag: ${{env.FLUTTER_BUILD_VERSION}} + excludeTypes: "" + includeInvalidCommits: true - name: release uses: actions/github-script@v5 if: ${{ (steps.bump.outputs.release == 'true') && (env.modified == 'true') }} @@ -80,23 +84,3 @@ jobs: repo: context.repo.repo, tag_name: "${{steps.bump.outputs.version}}", }); - build_and_deploy: - if: github.event.pull_request.merged - runs-on: ubuntu-latest - needs: merge - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.13.x" - channel: "stable" - - name: Setup flutter - run: flutter pub get - - name: build - run: | - cd example - flutter build web -o ../build --no-tree-shake-icons --base-href "/zds_flutter/" - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: build diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8018333..6854f68 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -10,7 +10,7 @@ jobs: outputs: files: ${{steps.changed-files.outputs.any_changed}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} @@ -40,7 +40,7 @@ jobs: needs: changes if: needs.changes.outputs.files == 'true' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.head_ref }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d5e2e46 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: "Release" + +on: + push: + tags: + - "**" + +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.16.x" + channel: "stable" + - name: Setup flutter + run: flutter pub get + - name: build + run: | + cd example + flutter build web -o ../build --no-tree-shake-icons --base-href "/zds_flutter/" + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: build + - name: Publish + run: | + dart format . + dart fix --apply + dart pub publish diff --git a/lib/zds_flutter.dart b/lib/zds_flutter.dart index 45910d3..9e1a16c 100644 --- a/lib/zds_flutter.dart +++ b/lib/zds_flutter.dart @@ -11,5 +11,5 @@ export 'src/utils/localizations.dart'; export 'src/utils/theme.dart'; export 'src/utils/tools.dart'; -/// Name of package +/// Name of package ttttttttt const String packageName = 'zds_flutter';