Sync with OPTC-DB #2932
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: Sync with OPTC-DB | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 */12 * * *" | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
sync: | |
name: Sync with OPTC-DB | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [12.x] | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Checkout Master | |
uses: actions/checkout@v3 | |
with: | |
path: optc-pirate-rumble-db | |
- name: Checkout GH-Pages Branch | |
uses: actions/checkout@v3 | |
with: | |
path: pages | |
ref: gh-pages | |
- name: Checkout OPTC-DB | |
uses: actions/checkout@v3 | |
with: | |
repository: optc-db/optc-db.github.io | |
path: optc-db | |
- name: Copy DB Files | |
run: | | |
cp -v optc-db/common/data/units.js optc-pirate-rumble-db/src/assets/data/units.js | |
cp -v optc-db/common/data/details.js optc-pirate-rumble-db/src/assets/data/details.js | |
cp -v optc-db/common/data/evolutions.js optc-pirate-rumble-db/src/assets/data/evolutions.js | |
cp -v optc-db/common/js/utils.js optc-pirate-rumble-db/src/assets/data/utils.js | |
cp -v optc-db/common/data/aliases.js optc-pirate-rumble-db/src/assets/data/aliases.js | |
cp -v optc-db/common/data/families.js optc-pirate-rumble-db/src/assets/data/families.js | |
cp -v optc-db/common/data/rumble.json optc-pirate-rumble-db/src/assets/data/rumble.json | |
- name: Add Files and Commit | |
run: | | |
cd optc-pirate-rumble-db | |
git config --global user.email "[email protected]" | |
git config --global user.name "ThePieBandit" | |
git add src/assets/data | |
git diff-index --quiet HEAD || git commit -m "Automatic publish syncing the latest from OPTC-DB" | |
git push | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
run: | | |
cd optc-pirate-rumble-db | |
npm install | |
- name: Build | |
run: | | |
cd optc-pirate-rumble-db | |
npm run build | |
# - name: Conventional Changelog Action | |
# id: changelog | |
# uses: TriPSs/conventional-changelog-action@v3 | |
# with: | |
# github-token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }} | |
# output-file: "false" | |
# - name: Create Release | |
# uses: actions/create-release@v1 | |
# if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }} | |
# with: | |
# tag_name: ${{ steps.changelog.outputs.tag }} | |
# release_name: ${{ steps.changelog.outputs.tag }} | |
# body: ${{ steps.changelog.outputs.clean_changelog }} | |
- name: Deploy | |
run: | | |
cd pages | |
git config --global user.email "[email protected]" | |
git config --global user.name "ThePieBandit" | |
cp -r ../optc-pirate-rumble-db/dist/optc-pirate-rumble-db/* ./ | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Automatic publish to gh-pages" | |
git push | |
# cd optc-pirate-rumble-db | |
# git config --global user.email "[email protected]" | |
# git config --global user.name "ThePieBandit" | |
# npm run deploy | |
# env: | |
# user_name: 'github-actions[bot]' | |
# user_email: 'github-actions[bot]@users.noreply.github.com' | |
# user_name: '[email protected]' | |
# user_email: 'ThePieBandit' | |
# github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }} | |
# repository: ${{ github.repository }} |