compiler/.github/workflows/node.js.yml

109 lines
2.9 KiB
YAML

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Compile TCGdex
on:
# Run manually
workflow_dispatch:
# Run on Webhook
repository_dispatch:
# Run when a push is made on master
push:
branches:
- master
# Run on any pull request
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'push') || github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- uses: actions/checkout@v2
with:
repository: tcgdex/cards-database
path: ./db
persist-credentials: false
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Lint
run: yarn && yarn lint
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- uses: actions/checkout@v2
with:
repository: tcgdex/cards-database
path: ./db
persist-credentials: false
- uses: actions/checkout@v2
with:
repository: tcgdex/distribution
path: ./dist
persist-credentials: false
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Compile Database
working-directory: ./db
run: yarn && yarn compile
- name: Build
working-directory: ./
run: |
yarn
yarn start
TCGDEX_COMPILER_LANG=fr yarn start
TCGDEX_COMPILER_LANG=es yarn start
TCGDEX_COMPILER_LANG=it yarn start
TCGDEX_COMPILER_LANG=pt yarn start
TCGDEX_COMPILER_LANG=de yarn start
- name: Commit Changes
id: commit
working-directory: ./dist
if: ${{ (github.event_name == 'push') || github.event_name == 'repository_dispatch' }}
continue-on-error: true
run: |
git config --local user.email "bot@tcgdex.net"
git config --local user.name "TCGdex [bot]"
git add .
git commit -m "Updated Database"
- name: Push changes
uses: ad-m/github-push-action@master
if: ${{ steps.commit.outcome == 'success' && (github.event_name == 'push' || github.event_name == 'repository_dispatch') }}
with:
github_token: ${{ secrets.PUSH_TOKEN }}
directory: ./dist
repository: tcgdex/distribution
# - name: Upload
# run: yarn upload
# if: ${{ steps.commit.outcome == 'success' && (github.event_name == 'push' || github.event_name == 'repository_dispatch') }}
# env:
# UPLOAD_REMOTE: ${{ secrets.UPLOAD_REMOTE }}
# UPLOAD_DIST: ${{ secrets.UPLOAD_DIST }}
# UPLOAD_USERNAME: ${{ secrets.UPLOAD_USERNAME }}
# UPLOAD_PASSWORD: ${{ secrets.UPLOAD_PASSWORD }}