-
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 #11 from mtrdesign/ci-cd-2
Improve the deploy flow
- Loading branch information
Showing
7 changed files
with
166 additions
and
22 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
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
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,90 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
env: | ||
NODE_VERSION: "18.15.0" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: false | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
check: | ||
name: check | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
lfs: false | ||
|
||
- name: Install NodeJS | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Get build url | ||
id: get_distribution_build | ||
run: | | ||
BUILD_URL=$(node .github/scripts/find_build_url.js "$ASSETS") | ||
echo "build_url=$BUILD_URL" >> "$GITHUB_OUTPUT" | ||
echo "$BUILD_URL" | ||
env: | ||
ASSETS: ${{ toJson(github.event.release.assets) }} | ||
|
||
- name: Cd to the UI | ||
run: cd krait-ui | ||
|
||
- name: Download distribution build | ||
run: curl -O $DOWNLOAD_URL | ||
env: | ||
DOWNLOAD_URL: ${{ steps.get_distribution_build.outputs.build_url }} | ||
|
||
- name: Unzip distribution-package.zip | ||
run: unzip -q distribution-package.zip | ||
|
||
- name: Setup Vals | ||
run: | | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config user.name "github-actions[bot]"} | ||
- name: Update package version | ||
id: update_package_version | ||
run: | | ||
RELEASE_VERSION=$(echo "$VERSION" | sed -e 's/-beta\.[[:digit:]_-]\{1,\}//g') | ||
npm version $VERSION | ||
git push | ||
echo "tag=$RELEASE_VERSION" >> "$GITHUB_OUTPUT" | ||
git push --tags | ||
env: | ||
VERSION: ${{ github.event.release.tag_name }} | ||
|
||
- name: Publish the NPM package | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
|
||
- name: Update release tag | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const {TAG_NAME, RELEASE_ID} = process.env | ||
github.rest.repos.updateRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: RELEASE_ID, | ||
name: TAG_NAME, | ||
tag_name: TAG_NAME, | ||
}); | ||
env: | ||
RELEASE_ID: ${{ github.event.release.id }} | ||
TAG_NAME: ${{ steps.update_package_version.outputs.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 @@ | ||
.DS_Store |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules/ | |
dist/ | ||
npm-debug.log | ||
.idea | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.