-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch to new pattern for preparing and creating the release (#80)
- Loading branch information
1 parent
3336afd
commit f3bdcd3
Showing
1 changed file
with
28 additions
and
26 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 |
---|---|---|
|
@@ -13,6 +13,15 @@ on: | |
required: true | ||
default: false | ||
type: boolean | ||
version-increment-type: | ||
description: 'Which part of the version to increment:' | ||
required: true | ||
type: choice | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
default: 'patch' | ||
|
||
permissions: | ||
contents: write | ||
|
@@ -28,45 +37,30 @@ jobs: | |
token: ${{ secrets.AUTOMATION_USER_TOKEN }} | ||
fetch-depth: 0 | ||
|
||
- name: Get latest non-prerelease release | ||
id: latestrelease | ||
uses: cardinalby/git-get-release-action@v1 | ||
- uses: DevCycleHQ/release-action/prepare-release@main | ||
id: prepare-release | ||
with: | ||
latest: true | ||
prerelease: false | ||
draft: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
github-token: ${{ secrets.AUTOMATION_USER_TOKEN }} | ||
prerelease: ${{ github.event.inputs.prerelease }} | ||
draft: ${{ github.event.inputs.draft }} | ||
version-increment-type: ${{ github.event.inputs.version-increment-type }} | ||
|
||
- name: Get next version | ||
id: semverbump | ||
uses: WyriHaximus/[email protected] | ||
with: | ||
version: ${{ steps.latestrelease.outputs.tag_name }} | ||
|
||
- name: Update Version in code | ||
run: | | ||
sed -i "s/VERSION = '[0-9]\+\.[0-9]\+\.[0-9]\+'/VERSION = '${{steps.semverbump.outputs.minor}}'/g" ./lib/devcycle-ruby-server-sdk/version.rb | ||
sed -i "s/VERSION = '[0-9]\+\.[0-9]\+\.[0-9]\+'/VERSION = '${{steps.prepare-release.outputs.next-release-tag}}'/g" ./lib/devcycle-ruby-server-sdk/version.rb | ||
- name: Commit version change | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "DevCycle Automation" | ||
git add ./lib/devcycle-ruby-server-sdk/version.rb | ||
git commit -m "Release ${{steps.semverbump.outputs.minor}}" | ||
git commit -m "Release ${{steps.prepare-release.outputs.next-release-tag}}" | ||
- name: Push version change | ||
run: | | ||
git push origin HEAD:main | ||
if: inputs.prerelease != true && inputs.draft != true | ||
|
||
- name: Push version change (prerelease) | ||
run: | | ||
git branch --force --track ${BRANCH} | ||
git push origin ${BRANCH} | ||
env: | ||
BRANCH: prerelease-${{ steps.semverbump.outputs.minor }} | ||
if: inputs.prerelease == true && inputs.draft != true | ||
if: inputs.draft != true | ||
|
||
- name: Set up Ruby 3 | ||
uses: ruby/setup-ruby@v1 | ||
|
@@ -86,9 +80,17 @@ jobs: | |
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}" | ||
if: inputs.prerelease != true && inputs.draft != true | ||
|
||
- name: Release SDK | ||
uses: DevCycleHQ/release-action/gh-release@main | ||
- uses: DevCycleHQ/release-action/create-release@main | ||
id: create-release | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ steps.prepare-release.outputs.next-release-tag }} | ||
target: main | ||
prerelease: ${{ github.event.inputs.prerelease }} | ||
draft: ${{ github.event.inputs.draft }} | ||
changelog: ${{ steps.prepare-release.outputs.changelog }} | ||
|
||
- name: Display link to release | ||
run: | | ||
echo "::notice title=Release ID::${{ steps.create-release.outputs.release-id }}" | ||
echo "::notice title=Release URL::${{ steps.create-release.outputs.release-url }}" |