-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd04920
commit 4f2c5d2
Showing
4 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Publish Package | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dry-run: | ||
description: 'Validate but do not push the package' | ||
type: boolean | ||
required: true | ||
workflow_call: | ||
inputs: | ||
dry-run: | ||
description: 'Validate but do not push the package' | ||
type: boolean | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
name: Publish Package | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
|
||
strategy: | ||
matrix: | ||
package: ['embrace_platform_interface', 'embrace_ios', 'embrace_android', 'embrace', 'embrace_dio'] | ||
fail-fast: true | ||
max-parallel: 1 # Publish the packages in sequential order | ||
|
||
steps: | ||
- name: 📚 Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: 🐦 Setup Flutter | ||
uses: embrace-io/flutter-action@v2 | ||
with: | ||
flutter-version: '3.3.1' | ||
channel: stable | ||
cache: true | ||
|
||
- name: Get Publishing Credentials | ||
run: | | ||
mkdir -p $XDG_CONFIG_HOME/dart | ||
cat <<EOF > $XDG_CONFIG_HOME/dart/pub-credentials.json | ||
${{ secrets.FLUTTER_PUB_CREDENTIALS }} | ||
EOF | ||
- name: Publish Dry Run | ||
run: | | ||
cd ${{ matrix.package }} | ||
flutter config --no-analytics | ||
flutter pub publish --dry-run | ||
- name: Publish | ||
if: ${{ inputs.dry-run == false }} | ||
run: | | ||
cd ${{ matrix.package }} | ||
flutter pub publish -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Release | ||
|
||
env: | ||
REPO_PATH: 'embrace-flutter-sdk' | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dry-run: | ||
description: 'Validate but do not push the package' | ||
type: boolean | ||
required: true | ||
workflow_call: | ||
inputs: | ||
dry-run: | ||
description: 'Validate but do not push the package' | ||
type: boolean | ||
required: true | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
verify-versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 📚 Git Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
lfs: true | ||
path: ${{ env.REPO_PATH }} | ||
|
||
- name: Setup yq | ||
run: | | ||
sudo snap install yq | ||
- name: Verify Package Versions | ||
run: | | ||
cd ${{ env.REPO_PATH }} | ||
./verify_versions.sh | ||
publish-packages: | ||
name: Publish Packages | ||
needs: verify-versions | ||
uses: ./.github/workflows/publish_flutter_packages.yaml | ||
with: | ||
dry-run: ${{ inputs.dry-run }} | ||
secrets: inherit | ||
|
||
create-release: | ||
name: Create Release | ||
needs: publish-packages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 📚 Git Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
lfs: true | ||
path: ${{ env.REPO_PATH }} | ||
|
||
- name: Setup yq | ||
run: | | ||
sudo snap install yq | ||
- name: Parse Version | ||
run: | | ||
cd ${{ env.REPO_PATH }} | ||
export PACKAGE_VERSION=$(yq -r .version embrace/pubspec.yaml) | ||
echo "${PACKAGE_VERSION}" | ||
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV | ||
- name: Tag commit | ||
run: | | ||
cd ${{ env.REPO_PATH }} | ||
git config --global user.name "embrace-ci" | ||
git config --global user.email "[email protected]" | ||
git tag -a ${{ env.PACKAGE_VERSION }} -m "${{ env.PACKAGE_VERSION }}" | ||
- name: Push Tag | ||
if: ${{ inputs.dry-run == false }} | ||
run: | | ||
cd ${{ env.REPO_PATH }} | ||
git push --tags | ||
- name: Create Release | ||
if: ${{ inputs.dry-run == false }} | ||
run: | | ||
cd ${{ env.REPO_PATH }} | ||
gh release create ${{ env.PACKAGE_VERSION }} -t ${{ env.PACKAGE_VERSION }} -F embrace/CHANGELOG.md | ||
- name: Record SDK Version History | ||
if: ${{ inputs.dry-run == false }} | ||
run: | | ||
curl -X POST ${{ vars.SDK_VERSION_URL }}/flutter/version/ -H 'X-Embrace-CI: ${{ secrets.SDK_VERSION_TOKEN }}' -H 'Content-Type: application/json' -d '{"version": "${{ env.PACKAGE_VERSION }}"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Invokes the release workflow whenever a release candidate PR is merged | ||
name: RC Release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
publish: | ||
if: contains(github.event.pull_request.labels.*.name, 'release-candidate') && github.event.pull_request.merged == true | ||
name: Publish Release | ||
uses: ./.github/workflows/release.yaml | ||
with: | ||
dry-run: false | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Invokes the release workflow in dry-run mode whenever a release candidate PR is opened or updated | ||
name: RC-PR | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
|
||
rc-publish-dry-run: | ||
name: Publish Release (dry-run) | ||
if: contains(github.event.pull_request.labels.*.name, 'release-candidate') | ||
uses: ./.github/workflows/release.yaml | ||
with: | ||
dry-run: true | ||
secrets: inherit |