Skip to content

Commit

Permalink
ci: Melos publishing from workflow (#3309)
Browse files Browse the repository at this point in the history
With this PR we'll be able to publish by running an action from the
Actions tab which will create a release PR that we can review and when
that PR is merged it will tag all new packages and trigger release
workflows for them.
  • Loading branch information
spydon authored Sep 20, 2024
1 parent ebc4741 commit d4d9cb6
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release-prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Prepare release
on:
workflow_dispatch:
inputs:
prerelease:
description: 'Version as prerelease'
required: false
default: false
type: boolean

jobs:
prepare-release:
name: Prepare release
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v3
with:
run-versioning: ${{ inputs.prerelease == false }}
run-versioning-prerelease: ${{ inputs.prerelease == true }}
publish-dry-run: true
create-pr: true
22 changes: 22 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish packages
on:
# Enable to also publish, when pushing a tag
#push:
# tags:
# - '*'
workflow_dispatch:

jobs:
publish-packages:
name: Publish packages
permissions:
contents: write
id-token: write # Required for authentication using OIDC
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v3
with:
publish: true

25 changes: 25 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tag release
on:
push:
branches: [main]

jobs:
publish-packages:
name: Create tags for release
permissions:
contents: write
runs-on: [ ubuntu-latest ]
if: contains(github.event.head_commit.message, 'chore(release)')
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v3
with:
tag: true
- run: |
melos exec -c1 --no-published --no-private --order-dependents -- \
gh workflow run release-publish.yml \
--ref \$MELOS_PACKAGE_NAME-v\$MELOS_PACKAGE_VERSION
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit d4d9cb6

Please sign in to comment.