Update WQX #175
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 WQX | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 6' | |
permissions: | |
contents: write | |
jobs: | |
update: | |
name: Update | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Node.js 18.x | |
uses: actions/setup-node@master | |
with: | |
node-version: 18.x | |
- name: Create .npmrc | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Cache npm | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Use npm 8 | |
run: | | |
npm install -g npm@8 | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Download and rebuild allowed values | |
run: | | |
npm run download | |
npm run build | |
npm run lint | |
- name: Check for file changes | |
run: | | |
git status --porcelain | |
echo "change=$(git status --porcelain | wc -l)" >> $GITHUB_ENV | |
- if: env.change != 0 | |
name: Commit & push changes | |
run: | | |
git config --local user.name ${{ github.actor }} | |
git config --local user.email [email protected] | |
git add -A | |
git commit -a -m 'ci: update allowed values' | |
npm version patch -m 'chore: bump version to %s' | |
git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:${GITHUB_REF#refs/*/} --follow-tags --force --tags | |
- if: env.change != 0 | |
name: Publish | |
run: | | |
cp package.json dist/package.json | |
sed -i 's/husky install//' dist/package.json | |
npm publish ./dist | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# - | |
# if: env.change != 0 | |
# name: Trigger @gordonfn/data-schema rebuild | |
# run: | | |
# curl -X POST https://api.github.com/repos/gordonfn/schema/dispatches \ | |
# -H 'Accept: application/vnd.github.everest-preview+json' \ | |
# -u ${{ secrets.GITHUB_TOKEN }} \ | |
# --data '{"event_type": "wqx", "client_payload": {}' |