From 531d0d950ef025961456866c59e3013b8b5d706f 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 | 94 ++++++++++++----------------------- .github/workflows/pr.yml | 4 +- .github/workflows/release.yml | 31 ++++++++++++ CHANGELOG.md | 13 +++++ lib/zds_flutter.dart | 2 +- pubspec.yaml | 2 +- 6 files changed, 81 insertions(+), 65 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index f1c2019..02903c1 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,34 +1,33 @@ name: "Merge" on: + push: 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.all_changed_files_count }} + # 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 + bump_and_tag: runs-on: ubuntu-latest timeout-minutes: 20 needs: changes - if: needs.changes.outputs.files == 'true' + if: needs.changes.outputs.any_changed != '0' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.head_ref }} @@ -38,15 +37,7 @@ jobs: run: dart pub global activate cider - 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 + echo "FLUTTER_BUILD_VERSION=$(cider bump patch)" >> "$GITHUB_ENV" - name: Update id: update run: | @@ -55,48 +46,29 @@ jobs: git add -A git commit --amend --no-edit git push -f - echo "newSha=$(git rev-parse ${{github.event.pull_request.head.sha}})" >> $GITHUB_ENV + echo "newSha=$(git rev-parse HEAD)" >> $GITHUB_ENV - name: Create tag - uses: actions/github-script@v6 + id: tag + uses: mathieudutour/github-tag-action@v6.1 with: - script: | - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'refs/tags/${{env.FLUTTER_BUILD_VERSION}}', - sha: "${{env.newSha}}" - }) - - name: release - uses: actions/github-script@v5 - if: ${{ (steps.bump.outputs.release == 'true') && (env.modified == 'true') }} - with: - script: | - github.rest.repos.createRelease({ - draft: false, - generate_release_notes: true, - name: "${{steps.bump.outputs.version}}", - owner: context.repo.owner, - prerelease: false, - 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 + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{env.FLUTTER_BUILD_VERSION}} + tag_prefix: "" + - name: Update CHANGELOG + id: changelog + uses: requarks/changelog-action@v1 with: - flutter-version: "3.13.x" - channel: "stable" - - name: Setup flutter - run: flutter pub get - - name: build + token: ${{ github.token }} + tag: ${{env.FLUTTER_BUILD_VERSION}} + excludeTypes: "" + includeInvalidCommits: true + - name: Push changelog 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 + git add . + git commit --amend --no-edit + git push -f + - name: Release + uses: softprops/action-gh-release@v1 with: - folder: build + body: "https://pub.dev/packages/zds_flutter/versions/${{env.FLUTTER_BUILD_VERSION}}" + tag_name: ${{env.FLUTTER_BUILD_VERSION}} 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..86f0814 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: "Release" + +on: + push: + # tags: + # - "**"±TODO: + +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/CHANGELOG.md b/CHANGELOG.md index 91b313e..0d27abb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [1.0.2] - 2024-01-03 +### :flying_saucer: Other Changes +- [`6862ac0`](https://github.com/ZebraDevs/zds_flutter/commit/6862ac0811773e6adc4bf6aa1b1901e404eb6b2e) - actions *(commit by [@thelukewalton](https://github.com/thelukewalton))* + + +## [1.0.1] - 2024-01-03 +### :flying_saucer: Other Changes +- [`e8628a1`](https://github.com/ZebraDevs/zds_flutter/commit/e8628a1a8cf76ada08a64a0312c1f7efd23c6cd5) - actions *(commit by [@thelukewalton](https://github.com/thelukewalton))* + + ## [1.0.0] - 2024-01-02 ### :sparkles: New features @@ -9,3 +19,6 @@ ### :sparkles: New Features - [`885fa19`](https://github.com/zebradevs/zds-flutter/commit/885fa19d4d0ec4426a259b61cb828b6c9fac175e) - init. _(commit by [@thelukewalton](https://github.com/thelukewalton))_ + +[1.0.1]: https://github.com/ZebraDevs/zds_flutter/compare/v1.0.2...1.0.1 +[1.0.2]: https://github.com/ZebraDevs/zds_flutter/compare/1.0.1...1.0.2 \ No newline at end of file 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'; diff --git a/pubspec.yaml b/pubspec.yaml index 25aeecc..d9f8c9e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: zds_flutter description: Zebra Design System components for Flutter. A selection of UI components from Zebra Technologies. -version: 1.0.0 +version: 1.0.2 homepage: https://github.com/zebradevs/zds_flutter repository: https://github.com/zebradevs/zds_flutter issue_tracker: https://github.com/zebradevs/zds_flutter/issues