-
Notifications
You must be signed in to change notification settings - Fork 4
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
e262742
commit 5ac4457
Showing
1 changed file
with
81 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,81 @@ | ||
name: 'Release and Build' | ||
description: 'Build the project, commit changes, create a new release, and tag it' | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
prerelease: | ||
description: "Prerelease" | ||
required: true | ||
default: false | ||
type: boolean | ||
draft: | ||
description: "Draft" | ||
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 | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' # Adjust this to your project's Node.js version | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: yarn install | ||
|
||
- name: Build project | ||
shell: bash | ||
run: yarn build | ||
- name: Prepare Release | ||
id: prepare_release | ||
uses: DevCycleHQ/release-action/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
version-increment-type: ${{ inputs.version-increment-type }} | ||
prerelease: ${{ inputs.prerelease }} | ||
draft: ${{ inputs.draft }} | ||
- name: Commit version change | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "DevCycle Automation" | ||
git add . | ||
git commit -m "Release ${{steps.prepare_release.outputs.next-release-tag}}" | ||
- name: Push version change | ||
run: | | ||
git push origin HEAD:main | ||
if: inputs.draft != true | ||
- name: Create Release | ||
id: create_release | ||
uses: DevCycleHQ/release-action/[email protected] | ||
with: | ||
tag: ${{ steps.prepare_release.outputs.next-release-tag }} | ||
target: ${{ github.sha }} | ||
changelog: ${{ steps.prepare_release.outputs.changelog }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
prerelease: ${{ inputs.prerelease }} | ||
draft: ${{ inputs.draft }} | ||
|
||
outputs: | ||
release-tag: | ||
description: 'Tag used for the release' | ||
value: ${{ steps.prepare_release.outputs.next-release-tag }} | ||
release-url: | ||
description: 'URL of the created release' | ||
value: ${{ steps.create_release.outputs.release-url }} |