-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: upload checksum (#5) * Feat: Nightly workflow * Fix: Double checkout Co-authored-by: Nico Prananta <[email protected]>
- Loading branch information
1 parent
de7f1eb
commit 5298c19
Showing
1 changed file
with
78 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,78 @@ | ||
name: 🌒 Nightly Release | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 7 * * *" # every day at 12AM PST | ||
|
||
jobs: | ||
# HEADS UP! this "nightly" job will only ever run on the `main` branch due to it being a cron job, | ||
# and the last commit on main will be what github shows as the trigger | ||
# however in the checkout below we specify the `dev` branch, so all the scripts | ||
# in this job will be ran from that, confusing i know, so in some cases we'll need to create | ||
# multiple PRs when modifying nightly release processes | ||
nightly: | ||
name: 🌒 Nightly Release | ||
if: github.repository == 'hyperjumptech/monika' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
# allows this to be used in the `comment` job below | ||
NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }} | ||
steps: | ||
- name: 🛑 Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
|
||
- name: ⬇️ Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14 | ||
|
||
- run: npm ci | ||
|
||
- run: npm test | ||
|
||
- name: ⤴️ Update Version | ||
id: version | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Monika Bot" | ||
SHA=$(git rev-parse HEAD) | ||
SHORT_SHA=${SHA::7} | ||
DATE=$(date '+%Y%m%d') | ||
NEXT_VERSION=0.0.0-nightly-${DATE}-${SHORT_SHA} | ||
echo ::set-output name=NEXT_VERSION::${NEXT_VERSION} | ||
git checkout -b nightly/${NEXT_VERSION} | ||
if [ -z "$(git status --porcelain)" ]; then | ||
echo "✨" | ||
else | ||
echo "dirty working directory..." | ||
git add . | ||
git commit -m "dirty working directory..." | ||
fi | ||
npm version ${NEXT_VERSION} | ||
- run: npm pack | ||
|
||
- run: npm install -g ./hyperjumptech-monika-*.tgz | ||
|
||
- run: npm run prod_test | ||
|
||
- name: 🏷 Push Tag | ||
run: git push origin --tags | ||
|
||
- name: 🔐 Setup npm auth | ||
run: | | ||
echo "registry=https://registry.npmjs.org" >> ~/.npmrc | ||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc | ||
- name: 🚀 Publish | ||
run: npm run publish | ||
|
||
- name: 🐱 Create GitHub release | ||
uses: actions/create-release@v1 | ||
with: | ||
draft: false | ||
prerelease: true | ||
release_name: v${{ steps.version.outputs.NEXT_VERSION }} | ||
tag_name: v${{ steps.version.outputs.NEXT_VERSION }} |