ci(publishing): update the publish workflow to automate updating the version and commit it, then push the changes to Github repository

pull/1878/head
Ellet 11 months ago
parent 96bf7af691
commit 6de04978db
  1. 22
      .github/workflows/publish.yml

@ -9,7 +9,9 @@ jobs:
publish: publish:
permissions: permissions:
id-token: write id-token: write
contents: write # For uploading to the release assets # Give the default GITHUB_TOKEN write permission to commit and push the changed files to the repository.
# Also required for uploading files to the Release assets
contents: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -42,6 +44,24 @@ jobs:
# - name: Update the authorization requests to "https://pub.dev" to use the environment variable "PUB_TOKEN". # - name: Update the authorization requests to "https://pub.dev" to use the environment variable "PUB_TOKEN".
# run: dart pub token add https://pub.dev --env-var PUB_TOKEN # run: dart pub token add https://pub.dev --env-var PUB_TOKEN
# TODO: We might automate updating the CHANGELOG.md for all the packages too
# Before publishing the new packages, update the version for all the packages first
# Extract version from the tag (handles optional 'v' prefix)
- name: Extract version
id: extract_version
run: |
version=$(echo ${GITHUB_REF} | sed 's/^refs\/tags\/\(.*\)$/\1/')
echo ::set-output name=VERSION::${version}
- name: Update the version for all the packages
run: ./scripts/regenerate_versions.dart ${{ steps.extract_version.outputs.VERSION }}
- name: Commit the changes of updating version for all the packages
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(version): update to version ${{ steps.extract_version.outputs.VERSION }}"
- name: Publish flutter_quill - name: Publish flutter_quill
run: flutter pub publish --force run: flutter pub publish --force

Loading…
Cancel
Save