-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflows to auto update, publish and release
- Loading branch information
Showing
4 changed files
with
91 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,2 @@ | ||
# Enforce Unix newlines | ||
* text=auto eol=lf |
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,21 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- v*.*.* | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- name: Publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,16 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v*.*.* | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Release | ||
run: gh release create "${GITHUB_REF#refs/tags/}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,52 @@ | ||
name: Auto Update | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # Runs at 00:00 UTC every day | ||
workflow_dispatch: | ||
inputs: | ||
force: | ||
description: Force Update | ||
default: '0' | ||
dry: | ||
description: Dry Run | ||
default: '1' | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ssh-key: ${{ secrets.DEPLOY_KEY }} | ||
- uses: git-actions/set-user@v1 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
- run: npm ci | ||
- name: Update | ||
run: | | ||
force="${{ github.event.inputs.force }}" | ||
dry="${{ github.event.inputs.dry }}" | ||
# Check for Updates | ||
if npm run check; then | ||
if [ "$force" != "1" ]; then | ||
exit 0 # exit if there are no changes | ||
fi | ||
elif [ $? -ge 4 ]; then | ||
exit 1 # exit if icons are removed | ||
fi | ||
# Update | ||
npm run update | ||
git commit -am 'Auto Update' || [ "$force" = "1" ] || exit 1 | ||
# Bump Version | ||
npm version patch | ||
# Push | ||
if [ "$dry" = "1" ]; then | ||
exit 0 | ||
fi | ||
git push --follow-tags |