Sync new crew #3103
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 new crew | |
on: | |
schedule: | |
- cron: '0 * * * *' | |
- cron: '*/5 15 * * 2' | |
- cron: '45 7 * * *' | |
workflow_dispatch: | |
inputs: | |
ONLY_SYNC_NEW_CREW: | |
description: 'Only sync if there are new crew' | |
required: true | |
default: true | |
env: | |
PLAYER_EN_USERNAME: ${{ secrets.PLAYER_EN_USERNAME }} | |
PLAYER_EN_PASSWORD: ${{ secrets.PLAYER_EN_PASSWORD }} | |
PLAYER_FR_USERNAME: ${{ secrets.PLAYER_FR_USERNAME }} | |
PLAYER_FR_PASSWORD: ${{ secrets.PLAYER_FR_PASSWORD }} | |
PLAYER_DE_USERNAME: ${{ secrets.PLAYER_DE_USERNAME }} | |
PLAYER_DE_PASSWORD: ${{ secrets.PLAYER_DE_PASSWORD }} | |
PLAYER_SP_USERNAME: ${{ secrets.PLAYER_SP_USERNAME }} | |
PLAYER_SP_PASSWORD: ${{ secrets.PLAYER_SP_PASSWORD }} | |
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
GOOGLE_API_KEY_2: ${{ secrets.GOOGLE_API_KEY_2 }} | |
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
GUILD_ID: ${{ secrets.GUILD_ID }} | |
GDOCS_TOKEN: ${{ secrets.GDOCS_TOKEN }} | |
REGENERATE_KEYSTONES: "true" | |
EXIT_IF_NO_NEW_CREW: ${{ github.event.inputs.ONLY_SYNC_NEW_CREW != 'false' && github.event.schedule != '45 7 * * *' }} | |
NODE_TLS_REJECT_UNAUTHORIZED: "0" | |
BBSECRET: ${{ secrets.BBSECRET }} | |
jobs: | |
# Checkout all repos | |
Sync-New-Crew: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update system package list | |
run: sudo apt update | |
- name: Install system packages | |
run: sudo apt install libvips-dev libglib2.0-dev | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Website - Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: stt-datacore/website | |
token: ${{ secrets.GH_ACCESS_TOKEN }} | |
path: website | |
- name: Scripts - Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: stt-datacore/scripts | |
token: ${{ secrets.GH_ACCESS_TOKEN }} | |
path: scripts | |
- name: Zhatvash - Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: stt-datacore/zhatvash | |
token: ${{ secrets.GH_ACCESS_TOKEN }} | |
path: scripts/zhatvash | |
- name: Scripts - npm install | |
run: npm ci | |
working-directory: scripts | |
- name: Scripts - parseallcrew.js | |
id: parseallcrew | |
run: node parseallcrew.js | |
working-directory: scripts | |
- name: Website - Check for changes | |
id: changes | |
run: | | |
if [[ `git status --porcelain` ]]; then | |
echo "::set-output name=changes::true" | |
else | |
echo "::set-output name=changes::false" | |
fi | |
working-directory: website | |
- name: Website - yarn install | |
if: ${{ steps.changes.outputs.changes == 'true' }} | |
run: yarn install | |
working-directory: website | |
- name: Website - node scripts/precalculate.js | |
if: ${{ steps.changes.outputs.changes == 'true' }} | |
run: node scripts/precalculate.js | |
working-directory: website | |
- name: Website - Commit and push changes | |
if: ${{ steps.changes.outputs.changes == 'true' }} | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "Autosync" | |
git pull --rebase || true | |
git push | |
working-directory: website | |
- name: Scripts - Commit and push changes, if any | |
if: ${{ steps.changes.outputs.changes == 'true' }} | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "Autosync" || true | |
git pull --rebase || true | |
git push | |
working-directory: scripts | |
- name: Zhatvash - Commit and push changes, if any | |
if: ${{ steps.changes.outputs.changes == 'true' }} | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "Autosync" || true | |
git pull --rebase || true | |
git push | |
working-directory: scripts/zhatvash |