add Japanese Wikipedia link #279
This file contains hidden or 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: Web | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- 'web/**' | |
- 'pnpm-lock.yaml' | |
- '.github/workflows/web.yml' | |
pull_request: | |
paths: ['web/**'] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./web | |
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
steps: | |
# Build | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- uses: pnpm/action-setup@v2.0.1 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 7 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- run: pnpm -C frontend-server run build:bundle | |
- run: pnpm -C frontend run build-assets | |
- run: pnpm -C frontend run build-server | |
- run: docker build -t animeta-frontend -f Dockerfile.prebuilt . | |
# Deploy | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
workload_identity_provider: 'projects/87165905547/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions' | |
service_account: 'animeta-github-actions@ditto-1470749749381.iam.gserviceaccount.com' | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
- name: Upload assets | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: gsutil -m cp -z js,css,map -r frontend/dist/static gs://animeta-static/ | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker push | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: | | |
docker tag animeta-frontend ghcr.io/dittos/animeta-frontend:latest | |
docker push ghcr.io/dittos/animeta-frontend:latest | |
- uses: azure/setup-kubectl@v3 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
- name: Set up kubeconfig | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
env: | |
KUBECONFIG_DATA_BASE64: ${{ secrets.KUBECONFIG_DATA_BASE64 }} | |
run: | | |
mkdir ~/.kube | |
echo $KUBECONFIG_DATA_BASE64 | base64 -d > ~/.kube/config | |
- name: Rollout | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: | | |
kubectl rollout restart deployment/animeta-frontend | |
kubectl rollout status deployment/animeta-frontend |