Update #1380
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: Update | |
on: | |
schedule: | |
- cron: '0 */6 * * *' | |
workflow_dispatch: | |
jobs: | |
update_domains: | |
runs-on: ubuntu-latest | |
outputs: | |
changed: ${{ steps.compare-domains.outputs.changed }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
registry-url: https://registry.npmjs.org/ | |
- name: Get current domains.json | |
run: | | |
echo "Current domains.json:" | |
cat domains.json | |
- name: Get latest domains.json | |
id: get-latest-domains | |
run: | | |
set -e | |
curl -s https://rawcdn.githack.com/disposable/disposable-email-domains/master/domains.json > latest-domains.json | |
echo "Latest domains.json:" | |
cat latest-domains.json | |
- name: Compare domains.json files | |
id: compare-domains | |
run: | | |
if diff -q domains.json latest-domains.json; then | |
echo "No changes in domains.json" | |
echo "{changed}={false}" >> $GITHUB_OUTPUT | |
else | |
cp latest-domains.json domains.json | |
echo "Updated domains.json" | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git commit -am "Bump version" | |
npm version patch -m "Bump version to %s" | |
git push | |
fi | |
- name: Bump version and publish package | |
uses: JS-DevTools/npm-publish@v2 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
strategy: upgrade | |
if: ${{ steps.compare-domains.outputs.changed }} == 'true' |