playerUuid overhaul #489
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: Build | |
on: | |
push: | |
workflow_dispatch: | |
env: | |
SHOULD_DEPLOY: ${{ (!contains(github.event.head_commit.message , '[skip ci]') && github.repository == 'mc-wiki/mcw-calc' && github.ref == 'refs/heads/main') || github.event == 'workflow_dispatch' }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
deployments: write | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Sync translations | |
uses: crowdin/github-action@v2 | |
with: | |
upload_sources: true | |
upload_translations: true | |
import_eq_suggestions: false | |
download_sources: false | |
download_translations: true | |
push_translations: true | |
commit_message: New Crowdin translations [skip ci] | |
localization_branch_name: main | |
create_pull_request: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CROWDIN_PROJECT_ID: 684734 | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm run build --base=/static/ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Create GitHub deployment | |
uses: chrnorm/deployment-action@v2 | |
id: deployment | |
if: env.SHOULD_DEPLOY == 'true' | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment-url: https://tools.minecraft.wiki/static/ | |
environment: production | |
- name: Deploy to MW | |
if: env.SHOULD_DEPLOY == 'true' | |
run: pnpm run deploy | |
env: | |
ACCESS_TOKEN_PROD: ${{ secrets.ACCESS_TOKEN_PROD }} | |
# ACCESS_TOKEN_DEV: ${{ secrets.ACCESS_TOKEN_DEV }} | |
- name: rsync deployments | |
uses: burnett01/[email protected] | |
if: env.SHOULD_DEPLOY == 'true' | |
with: | |
switches: -avzr --delete | |
path: dist/ | |
remote_path: /var/www/html/static/ | |
remote_host: ${{ secrets.TOOLS_SSH_IP }} | |
remote_user: ${{ secrets.TOOLS_SSH_USER }} | |
remote_key: ${{ secrets.TOOLS_SSH_PRIVATE_KEY }} | |
- name: Purge Cloudflare cache | |
if: env.SHOULD_DEPLOY == 'true' | |
run: pnpm run purge | |
env: | |
WG_API_TOKEN: ${{ secrets.WG_API_TOKEN }} | |
- name: Update deployment status (success) | |
if: env.SHOULD_DEPLOY == 'true' && success() | |
uses: chrnorm/deployment-status@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment-url: https://tools.minecraft.wiki/static/tools/ | |
state: 'success' | |
deployment-id: ${{ steps.deployment.outputs.deployment_id }} | |
- name: Update deployment status (failure) | |
if: env.SHOULD_DEPLOY == 'true' && failure() | |
uses: chrnorm/deployment-status@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment-url: https://tools.minecraft.wiki/static/tools/ | |
state: 'failure' | |
deployment-id: ${{ steps.deployment.outputs.deployment_id }} |