Skip to content

Commit

Permalink
chore: merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
asartalo committed Apr 3, 2021
2 parents c61ab5b + d97b03e commit 904259d
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 2 deletions.
111 changes: 110 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.2.3 (2021-04-03)

## Features

- curent_version command ([ce26035](commit/ce26035))
- remote_tag_id command ([090a5fd](commit/090a5fd))

# 0.2.2 (2021-04-02)

## Features
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: release_tools
description: A collection of scripts to help with creating releases and publishing libraries.
version: 0.2.2
version: 0.2.3
homepage: https://github.com/asartalo/release_tools

environment:
Expand Down

0 comments on commit 904259d

Please sign in to comment.