Skip to content

Commit

Permalink
chore: chore ci
Browse files Browse the repository at this point in the history
  • Loading branch information
devcui committed Mar 21, 2024
1 parent 8ebd612 commit 9aff48f
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
name: CI

on:
push:
pull_request:
branches-ignore:
- gh-pages
push:
branches: [main, master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jwalton/gh-find-current-pr@v1
id: findPr
with:
state: all
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Comment on github
if: github.event.number
run: node ./scripts/_ci/github-comment.js "RELEASE" "[Using release @yelon, Preview Preparing...](https://github.com/hbyunzai/ng-yunzai/actions/runs/${{ github.run_id }})"
env:
ACCESS_REPO: ${{ github.repository }}
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }}
PR_NUMBER: ${{ github.event.number || steps.findPr.outputs.pr }}
ACCESS_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
- name: Install node modules
run: yarn install
- name: Build
run: ./scripts/_ci/deploy-pipelines.sh
- name: 'Deploy Site'
if: github.event.number
run: |
export DEPLOY_DOMAIN=https://preview-${{ github.event.number || steps.findPr.outputs.pr }}-ng-yunzai.surge.sh
export DEPLOY_DOMAIN=https://preview-${{ github.event.number }}-ng-yunzai.surge.sh
echo "Deploy to $DEPLOY_DOMAIN"
cp ./dist/browser/index.html ./dist/browser/404.html
npx surge --project ./dist/browser --domain $DEPLOY_DOMAIN
env:
ACCESS_REPO: ${{ github.repository }}
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }}
ACCESS_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
- name: 'Update comment on github'
if: github.event.number
run: |
export DEPLOY_DOMAIN=https://preview-${{ github.event.number || steps.findPr.outputs.pr }}-ng-yunzai.surge.sh
export DEPLOY_DOMAIN=https://preview-${{ github.event.number }}-ng-yunzai.surge.sh
node ./scripts/_ci/github-comment.js "RELEASE" "[Preview is ready!]($DEPLOY_DOMAIN)"
env:
ACCESS_REPO: ${{ github.repository }}
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }}
PR_NUMBER: ${{ github.event.number || steps.findPr.outputs.pr }}
ACCESS_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
- name: 'When failed'
if: failure()
if: github.event.number && failure()
run: node ./scripts/_ci/github-comment.js "RELEASE" "[Using release @yelon, Preview Failed](https://github.com/hbyunzai/ng-yunzai/actions/runs/${{ github.run_id }})"
env:
ACCESS_REPO: ${{ github.repository }}
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }}
PR_NUMBER: ${{ github.event.number || steps.findPr.outputs.pr }}
ACCESS_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
PR_NUMBER: ${{ github.event.number }}

build-day:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jwalton/gh-find-current-pr@v1
id: findPr
with:
state: all
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Comment on github
if: github.event.number
run: node ./scripts/_ci/github-comment.js "RELEASE_DAY" "[Using day release @yelon, Preview Preparing...](https://github.com/hbyunzai/ng-yunzai/actions/runs/${{ github.run_id }})"
env:
ACCESS_REPO: ${{ github.repository }}
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }}
PR_NUMBER: ${{ github.event.number || steps.findPr.outputs.pr }}
ACCESS_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
- name: Install node modules
run: yarn install
- name: Build
run: ./scripts/_ci/deploy-pipelines.sh -day
- name: 'Deploy Site'
if: github.event.number
run: |
export DEPLOY_DOMAIN=https://preview-${{ github.event.number || steps.findPr.outputs.pr }}-day-ng-yunzai.surge.sh
export DEPLOY_DOMAIN=https://preview-${{ github.event.number }}-day-ng-yunzai.surge.sh
echo "Deploy to $DEPLOY_DOMAIN"
cp ./dist/browser/index.html ./dist/browser/404.html
npx surge --project ./dist/browser --domain $DEPLOY_DOMAIN
env:
ACCESS_REPO: ${{ github.repository }}
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }}
ACCESS_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
- name: 'Update comment on github'
if: github.event.number
run: |
export DEPLOY_DOMAIN=https://preview-${{ github.event.number || steps.findPr.outputs.pr }}-day-ng-yunzai.surge.sh
export DEPLOY_DOMAIN=https://preview-${{ github.event.number }}-day-ng-yunzai.surge.sh
node ./scripts/_ci/github-comment.js "RELEASE_DAY" "[Using day release @yelon, Preview is ready!]($DEPLOY_DOMAIN)"
env:
ACCESS_REPO: ${{ github.repository }}
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }}
PR_NUMBER: ${{ github.event.number || steps.findPr.outputs.pr }}
ACCESS_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
- name: 'When failed'
if: failure()
if: github.event.number && failure()
run: node ./scripts/_ci/github-comment.js "RELEASE" "[Using day release @yelon, Preview Failed](https://github.com/hbyunzai/ng-yunzai/actions/runs/${{ github.run_id }})"
env:
ACCESS_REPO: ${{ github.repository }}
ACCESS_TOKEN: ${{ secrets.CI_TOKEN }}
PR_NUMBER: ${{ github.event.number || steps.findPr.outputs.pr }}
ACCESS_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
PR_NUMBER: ${{ github.event.number }}

lint:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 9aff48f

Please sign in to comment.