Auto-update groups data #45
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
name: Auto-update groups data | |
on: | |
schedule: | |
# Every first of the month at 10:00 | |
- cron: '0 10 1 * *' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
- run: npm ci --no-audit | |
- run: npm test | |
publish: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
- run: npm ci --no-audit | |
- run: npm run update-groups | |
# See https://github.com/marketplace/actions/add-commit | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: Auto-update groups | |
author_email: [email protected] | |
message: 'Auto-update groups' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
echo 'Set git config user.email...' | |
git config --global user.email "[email protected]" | |
echo 'Set git config user.name...' | |
git config --global user.name "Auto-Update groups" | |
echo 'Increment patch version number...' | |
npm version patch | |
echo 'Pushing commits to repo...' | |
git push origin main | |
echo 'Pushing tags to repo...' | |
git push origin main --tags | |
echo 'Setup .npmrc...' | |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc | |
echo 'Publish on NPM...' | |
npm publish | |
echo 'Done!' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings |