diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd3156a0..20ab6bc5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,8 +6,6 @@ name: Node.js Build CI on: push: branches: [master] - tags: - - 'v*' pull_request: branches: [master] @@ -34,49 +32,12 @@ jobs: key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}- - - - name: Start MongoDB - uses: supercharge/mongodb-github-action@1.7.0 - with: - mongodb-version: 4.4 - - name: Start Redis - uses: supercharge/redis-github-action@1.4.0 - with: - redis-version: 6 - - uses: pnpm/action-setup@v2.0.1 with: version: 6.0.2 - run_install: false - - name: Install Dependencies - run: | - pnpm i --no-optional + run_install: true - name: Build project run: | npm run bundle - - - uses: actions/cache@v2 - id: restore-build - with: - path: | - ./* - !./node_modules/* - key: ${{ github.sha }} - - - name: Test Bundle Server - run: | - bash scripts/workflow/test-server.sh - test: uses: ./.github/workflows/test.yml - - release: - if: ${{ startsWith(github.ref, 'refs/tags/v') }} - needs: [build, test] - uses: ./.github/workflows/release.yml - with: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - JWTSECRET: ${{secrets.JWTSECRET}} - HOST: ${{secrets.HOST}} - USER: ${{secrets.USER}} - PASSWORD: ${{secrets.PASSWORD}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 08a07147..db48c9c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,16 +1,7 @@ on: - workflow_call: - secrets: - GITHUB_TOKEN: - required: true - JWTSECRET: - required: true - HOST: - required: true - USER: - required: true - PASSWORD: - required: true + push: + tags: + - 'v*' name: Release @@ -23,18 +14,39 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - uses: actions/cache@v2 - id: restore-build - with: - path: | - ./* - !node_modules/* - key: ${{ github.sha }} - - uses: actions/setup-node@v2 with: node-version: 16.x + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.7.0 + with: + mongodb-version: 4.4 + - name: Start Redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + - name: Cache pnpm modules + uses: actions/cache@v2 + env: + cache-name: cache-pnpm-modules + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}- + - uses: pnpm/action-setup@v2.0.1 + with: + version: 6.0.2 + run_install: true + - name: Test + uses: ./.github/workflows/test.yml + - name: Build project + run: | + pnpm run bundle + - name: Test Bundle Server + run: | + bash scripts/workflow/test-server.sh - name: Zip Assets run: | git clone https://github.com/mx-space/assets.git --depth=1