From bee6861506bd4cc6660e8ba9020ae6ca77d1980b 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 | 85 ++++++++++++++--------------------- .github/workflows/pr.yml | 4 +- .github/workflows/release.yml | 31 +++++++++++++ lib/zds_flutter.dart | 2 +- pubspec.yaml | 2 +- 5 files changed, 68 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index f1c2019..f868712 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,34 +1,35 @@ 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.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 +39,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,24 +48,32 @@ 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}}" - }) + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{env.FLUTTER_BUILD_VERSION}} + - name: Update CHANGELOG + id: changelog + uses: requarks/changelog-action@v1 + with: + token: ${{ github.token }} + tag: ${{env.FLUTTER_BUILD_VERSION}} + excludeTypes: "" + includeInvalidCommits: true + - name: Push changelog + run: | + git add . + git commit --amend --no-edit + git push -f - name: release uses: actions/github-script@v5 - if: ${{ (steps.bump.outputs.release == 'true') && (env.modified == 'true') }} with: script: | github.rest.repos.createRelease({ - draft: false, + draft: false, generate_release_notes: true, name: "${{steps.bump.outputs.version}}", owner: context.repo.owner, @@ -80,23 +81,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'; diff --git a/pubspec.yaml b/pubspec.yaml index 25aeecc..b40a597 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.1 homepage: https://github.com/zebradevs/zds_flutter repository: https://github.com/zebradevs/zds_flutter issue_tracker: https://github.com/zebradevs/zds_flutter/issues