diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4825227af8..7a0c39a33c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,71 @@ name: CI on: push jobs: - # build: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'yarn' + - uses: actions/cache@v3 + with: + path: ./node_modules + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }} + - name: Install node modules + run: yarn install --frozen-lockfile + - name: Build artifacts + run: ./scripts/ci/build-artifacts.sh + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + - name: Comment on github + run: node ./scripts/azure/github-comment.js "[Preview Preparing...](https://github.com/ng-alain/delon/actions/runs/${{ github.run_id }})" + env: + ACCESS_REPO: ${{ secrets.ACCESS_REPO }} + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + - name: Build site + run: yarn run site:build + - name: 'Deploy Site' + run: | + export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain-delon.surge.sh + echo "Deploy to $DEPLOY_DOMAIN" + cp ./src/dist/browser/index.html ./src/dist/browser/404.html + npx surge --project ./src/dist/browser --domain $DEPLOY_DOMAIN + env: + ACCESS_REPO: $(ACCESS_REPO) + ACCESS_TOKEN: $(ACCESS_TOKEN) + SURGE_LOGIN: $(SURGE_LOGIN) + SURGE_TOKEN: $(SURGE_TOKEN) + - name: 'Update comment on github' + run: | + export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain-delon.surge.sh + node ./scripts/azure/github-comment.js "[Preview is ready!]($DEPLOY_DOMAIN)" + env: + ACCESS_REPO: $(ACCESS_REPO) + ACCESS_TOKEN: $(ACCESS_TOKEN) + + build-failed: + runs-on: ubuntu-latest + if: ${{ failure() }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'yarn' + - uses: actions/cache@v3 + with: + path: ./node_modules + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }} + - name: Install node modules + run: yarn install --frozen-lockfile + - name: Comment on github + run: node ./scripts/azure/github-comment.js "[Preview Build Failed!](https://github.com/ng-alain/delon/actions/runs/${{ github.run_id }})" + env: + ACCESS_REPO: $(ACCESS_REPO) + ACCESS_TOKEN: $(ACCESS_TOKEN) + test: runs-on: ubuntu-latest diff --git a/azure-pipelines.yml b/azure-pipelines_yml_del similarity index 100% rename from azure-pipelines.yml rename to azure-pipelines_yml_del