Sync new crew #5299
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" | |
LOAD_CREW_URL: ${{ secrets.LOAD_CREW_URL }} | |
DISMISS_CREW_URL: ${{ secrets.DISMISS_CREW_URL }} | |
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 zip bash | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Website - Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: stt-datacore/website | |
# Remove this for prod!!! | |
# ref: beta | |
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: DataScore - Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: stt-datacore/datascore | |
token: ${{ secrets.GH_ACCESS_TOKEN }} | |
path: datascore | |
- 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: Datascore - yarn install | |
if: ${{ steps.changes.outputs.changes == 'true' }} | |
run: yarn install | |
working-directory: datascore | |
- name: Datascore - calculate | |
if: ${{ steps.changes.outputs.changes == 'true' }} | |
id: datascore | |
run: bash calc.sh | |
working-directory: datascore | |
- 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 |