Update ci build script #15
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: Node.js CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- run: CI=true pnpm i | |
- run: pnpm run build | |
- name: Zip build | |
uses: thedoctor0/zip-release@master | |
with: | |
filename: app-${{ steps.tag_version.outputs.new_tag }}.zip | |
path: build | |
- name: Upload build zip artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-${{ steps.tag_version.outputs.new_tag }}.zip | |
path: app-${{ steps.tag_version.outputs.new_tag }}.zip | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
allowUpdates: true | |
artifactErrorsFailBuild: true | |
artifacts: app-${{ steps.tag_version.outputs.new_tag }}.zip | |
token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: true | |
removeArtifacts: true | |
- name: Prepare Deploy | |
uses: a7ul/tar-action@v1.1.0 | |
with: | |
command: c | |
cwd: './' | |
files: | | |
build/ | |
captain-definition | |
nginx.conf | |
expires.conf | |
outPath: deploy.tar | |
- name: Upload build zip artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deploy.tar | |
path: deploy.tar | |
- name: Deploy | |
uses: caprover/deploy-from-github@main | |
with: | |
server: '${{ secrets.DELIVERY_SERVER }}' | |
app: '${{ secrets.DELIVERY_APP_PROD }}' | |
token: '${{ secrets.DELIVERY_TOKEN_PROD }}' |