CI #984
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, pull_request, workflow_dispatch] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
name: CI | |
steps: | |
- name: setup redis | |
uses: shogo82148/actions-setup-redis@v1 | |
with: | |
redis-version: 5.x | |
- name: ping redis | |
run: redis-cli ping | |
- name: checkout the current branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
- name: checkout openupm/openupm repo for the data folder | |
uses: actions/checkout@v3 | |
with: | |
repository: openupm/openupm | |
ref: master | |
path: tmp-openupm | |
- name: move tmp-openupm/data to data | |
run: mv tmp-openupm/data data && rm -rf tmp-openupm | |
- name: install volta | |
uses: volta-cli/action@v4 | |
- name: npm install | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 3 | |
max_attempts: 3 | |
command: npm install | |
- name: npm run test | |
run: OPENUPM_DATA_PATH="${{ github.workspace }}/data" npm run test | |
build-website-us: | |
runs-on: macos-latest | |
needs: test | |
if: github.ref == 'refs/heads/main' && github.repository == 'openupm/openupm-next' | |
steps: | |
- name: checkout main repo | |
uses: actions/checkout@v3 | |
- name: checkout openupm/openupm repo for the data folder | |
uses: actions/checkout@v3 | |
with: | |
repository: openupm/openupm | |
ref: master | |
path: tmp-openupm | |
- name: move tmp-openupm/data to data | |
run: mv tmp-openupm/data data && rm -rf tmp-openupm | |
- name: install volta | |
uses: volta-cli/action@v4 | |
- name: npm install | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 3 | |
max_attempts: 3 | |
command: npm install | |
- name: npm run build:release | |
run: npm run build:release | |
- name: npm run docs:build | |
run: | | |
# Remove /zh/* pages | |
rm -rf docs/zh | |
# Build website | |
OPENUPM_DATA_PATH=../../data VITE_OPENUPM_REGION=us npm run docs:build | |
working-directory: apps/docs | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bundle-analysis-report | |
path: apps/docs/bundle-analyse.html | |
- name: deploy to openupm-next-website repo | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
repository-name: openupm/openupm-next-website | |
folder: apps/docs/docs/.vuepress/dist | |
single-commit: true | |
ssh-key: ${{ secrets.OPENUPM_NEXT_WEBSITE_DEPLOY_KEY }} | |
docker-web: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && github.repository == 'openupm/openupm-next' && github.event_name == 'push' | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: favoyang/openupm-web | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: apps/web/Dockerfile | |
push: true | |
tags: favoyang/openupm-web:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
docker-jobs: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && github.repository == 'openupm/openupm-next' && github.event_name == 'push' | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: favoyang/openupm-jobs | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: apps/jobs/Dockerfile | |
push: true | |
tags: favoyang/openupm-jobs:latest | |
labels: ${{ steps.meta.outputs.labels }} |