-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Nosto/feat/releasePipeline2
Borrow the createRelease workflow from DS
- Loading branch information
Showing
3 changed files
with
111 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,29 @@ | ||
## Description | ||
|
||
<!--- Describe your changes --> | ||
|
||
## Related Jira ticket | ||
|
||
<!--- Is there a Jira ticket for this change, if not - should there be? --> | ||
<!--- If working on a new feature or change, please discuss it in an ticket first --> | ||
<!--- If fixing a bug, there should be an ticket describing it with steps to reproduce --> | ||
<!--- Please link to the ticket here: --> | ||
|
||
## Documentation | ||
|
||
<!--- Is the change documented or should it be?, link the relevant wiki/confluence page here. --> | ||
|
||
## Checklist | ||
|
||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> | ||
|
||
- [ ] Pull Request is properly described. | ||
- [ ] The corresponding Jira ticket is updated. | ||
- [ ] I have requested a review from at least one reviewer. | ||
- [ ] The changes are tested | ||
- [ ] I have checked my code for any possible security vulnerabilities | ||
|
||
## Screenshots | ||
|
||
<!--- If there is a visual element to the PR please share screenshots --> | ||
<!--- Remember the saying "one picture says the same as a 1000 words". --> |
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,54 @@ | ||
name: Create Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
mode: | ||
type: choice | ||
description: "Release mode" | ||
required: true | ||
default: patch | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
jobs: | ||
github-release: | ||
runs-on: | ||
group: Personalisation | ||
labels: [self-hosted, linux, x64] | ||
steps: | ||
- name: Checkout current branch | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.head_ref || github.ref_name }} | ||
token: ${{ secrets.RELEASE_PAT_TOKEN }} | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Create tag | ||
id: tag-changelog | ||
shell: bash | ||
working-directory: ${{ github.workspace }}/.github/workflows | ||
env: | ||
mode: ${{ inputs.mode }} | ||
workspace: ${{ github.workspace }} | ||
run: ./scripts/release.sh | ||
|
||
- name: Create Github Release | ||
if: success() && steps.tag-changelog.outputs.new_version != '' | ||
env: | ||
tag: ${{ steps.tag-changelog.outputs.new_version }} | ||
GH_TOKEN: ${{ secrets.RELEASE_PAT_TOKEN }} | ||
shell: bash | ||
run: | | ||
gh release create "$tag" \ | ||
--repo "$GITHUB_REPOSITORY" \ | ||
--title "${GITHUB_REPOSITORY#*/} ${tag#v}" \ | ||
--generate-notes \ | ||
--verify-tag |
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,28 @@ | ||
#!/bin/sh | ||
|
||
# Setup git globals | ||
echo 'Config git globals' | ||
git config --global user.name "nosto-cicd" | ||
git config --global user.email "[email protected]" | ||
|
||
# Fetching current and new version | ||
echo 'Fetching current and the next version' | ||
current_version="$(git tag --list --sort=-creatordate | head -n 1)" | ||
new_version="$(npm --no-git-tag-version version $mode | cut -c2-)" | ||
echo "current_version=${current_version}" | ||
echo "new_version=${new_version}" | ||
|
||
# Creating git tag | ||
if [ ! -z "$new_version" ] | ||
then | ||
echo 'Creating git tag' | ||
# needed to be committed after the version update by npm version command | ||
git add $workspace/package*.json | ||
git commit -m 'Bump version' | ||
git tag -a $new_version -m "Tag $new_version for design system" | ||
git push origin master | ||
git push origin $new_version | ||
echo "new_version=${new_version}" >> $GITHUB_OUTPUT | ||
else | ||
echo "Skipping release as new version is invalid: $new_version" | ||
fi |