-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merge branch 'main' into next
- Loading branch information
Showing
3 changed files
with
118 additions
and
2 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 |
---|---|---|
|
@@ -20,8 +20,20 @@ jobs: | |
# This job will run on ubuntu virtual machine | ||
runs-on: ubuntu-latest | ||
needs: commitlint | ||
outputs: | ||
branch: ${{ steps.branchinfo.outputs.branch }} | ||
|
||
steps: | ||
|
||
- uses: nelonoel/[email protected] | ||
# Use branch name for whatever purpose | ||
- name: Store the branch name | ||
id: branchinfo | ||
run: echo "::set-output name=branch::${BRANCH_NAME}" | ||
|
||
- name: Check if we were able to save branch info | ||
run: echo ${{ steps.branchinfo.outputs.branch }} | ||
|
||
- uses: cedx/setup-dart@v2 | ||
with: | ||
release-channel: stable | ||
|
@@ -48,4 +60,101 @@ jobs: | |
uses: coverallsapp/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: lcov.info | ||
path-to-lcov: lcov.info | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: ${{ needs.test.outputs.branch == 'main' }} | ||
|
||
steps: | ||
- run: echo ${{ needs.test.outputs.branch }} | ||
|
||
- uses: cedx/setup-dart@v2 | ||
with: | ||
release-channel: stable | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get dependencies | ||
run: pub get | ||
|
||
- name: Get current version | ||
id: currentVersion | ||
run: echo "::set-output name=value::$(pub run release_tools current_version)" | ||
|
||
- run: echo ${{ steps.currentVersion.outputs.value }} | ||
|
||
- name: Get commitId of last tag of that version | ||
id: lastCommitId | ||
run: echo "::set-output name=value::$(pub run release_tools remote_tag_id ${{ steps.currentVersion.outputs.value }})" | ||
|
||
- run: echo ${{ steps.lastCommitId.outputs.value }} | ||
|
||
- name: Use commitId to check if we should release | ||
id: shouldRelease | ||
run: echo "::set-output name=value::$(pub run release_tools should_release --from ${{ steps.lastCommitId.outputs.value }})" | ||
|
||
- run: echo ${{ steps.shouldRelease.outputs.value }} | ||
|
||
- name: If we should release get the next version | ||
if: steps.shouldRelease.outputs.value == 'yes' | ||
id: nextVersion | ||
run: echo "::set-output name=value::$(pub run release_tools next_version --from ${{ steps.lastCommitId.outputs.value }})" | ||
|
||
- run: echo ${{ steps.nextVersion.outputs.value }} | ||
|
||
- name: Update version | ||
if: steps.shouldRelease.outputs.value == 'yes' | ||
id: updateVersion | ||
run: pub run release_tools update_version ${{ steps.nextVersion.outputs.value }} | ||
|
||
- name: Write changelog | ||
id: changelog | ||
if: steps.shouldRelease.outputs.value == 'yes' | ||
run: | | ||
output=$(pub run release_tools changelog --from ${{ steps.lastCommitId.outputs.value }} ${{ steps.nextVersion.outputs.value }}) | ||
echo "::set-output name=summary::$output" | ||
- name: Commit Release | ||
if: steps.shouldRelease.outputs.value == 'yes' | ||
run: | | ||
git diff | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add . | ||
git commit -m "chore(release): release for ${{ steps.nextVersion.outputs.value }}" | ||
git push | ||
- name: Create Release | ||
if: steps.shouldRelease.outputs.value == 'yes' | ||
id: createRelease | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.nextVersion.outputs.value }} | ||
release_name: Release ${{ steps.nextVersion.outputs.value }} | ||
body: | | ||
Changes in this Release | ||
${{ steps.changelog.outputs.summary }} | ||
draft: false | ||
prerelease: false | ||
|
||
# Publish | ||
- name: Setup credentials | ||
if: steps.shouldRelease.outputs.value == 'yes' | ||
run: | | ||
mkdir -p ~/.pub-cache | ||
cat <<EOF > ~/.pub-cache/credentials.json | ||
${{ secrets.PUB_CREDENTIALS }} | ||
EOF | ||
- name: Publish package | ||
if: steps.shouldRelease.outputs.value == 'yes' | ||
run: 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
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