Skip to content

Commit

Permalink
Add workflows to auto update, publish and release
Browse files Browse the repository at this point in the history
  • Loading branch information
marella committed Jul 4, 2021
1 parent 7551a2c commit 8173b98
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enforce Unix newlines
* text=auto eol=lf
21 changes: 21 additions & 0 deletions .github/workflows/publish.yml
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 }}
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
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 }}
52 changes: 52 additions & 0 deletions .github/workflows/update.yml
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

0 comments on commit 8173b98

Please sign in to comment.