More UI changes #22
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: CI | |
on: | |
push: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: ESLint | |
run: pnpm run lint | |
type-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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: Type Check | |
run: pnpm run type-check | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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: Run tests | |
run: pnpm run test:cov | |
- name: Upload coverage reports to Codecov | |
if: always() && github.repository == 'mc-wiki/mcw-calc' && github.ref == 'refs/heads/main' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Sync translations | |
uses: crowdin/github-action@v2 | |
if: github.repository == 'mc-wiki/mcw-calc' && github.ref == 'refs/heads/main' | |
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/ | |
deploy: | |
needs: build | |
if: (!contains(github.event.head_commit.message , '[skip ci]') && github.repository == 'mc-wiki/mcw-calc' && github.ref == 'refs/heads/main') || github.event == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
permissions: | |
deployments: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Create GitHub deployment | |
uses: chrnorm/deployment-action@v2 | |
id: deployment | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment-url: https://tools.minecraft.wiki/static/ | |
environment: production | |
- name: Deploy to MW | |
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] | |
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 | |
run: pnpm run purge | |
env: | |
WG_API_TOKEN: ${{ secrets.WG_API_TOKEN }} | |
- name: Update deployment status (success) | |
if: 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: 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 }} |