v1.27.0 #50
Workflow file for this run
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: CD | |
on: | |
release: | |
types: [released] | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: true | |
NODE_VERSION: 20 | |
jobs: | |
deploy: | |
name: Deploy Bot | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'pnpm' | |
- name: Install Dependencies | |
run: pnpm install --no-frozen-lockfile # For some reason, pnpm install fails with a frozen lockfile | |
- name: Build Bot | |
run: pnpm build | |
- name: Copy Files | |
run: | | |
cp package.json dist/package.json | |
cp pnpm-lock.yaml dist/pnpm-lock.yaml | |
cp knexfile.js dist/knexfile.js | |
mkdir -p dist/migrations | |
cp -r migrations/ dist/ | |
- name: Deploy Changes | |
uses: wopian/git-publish-subdir-action@develop | |
env: | |
REPO: self | |
BRANCH: production | |
FOLDER: dist | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SKIP_EMPTY_COMMITS: true | |
MESSAGE: ${{ github.event.release.tag_name }} {sha} | |
- name: Announce Deployment | |
if: success() | |
run: | | |
curl "https://control.sparkedhost.us/api/client/servers/${{ vars.SPARKEDHOST_SERVER }}/power" \ | |
-H 'Accept: application/json' \ | |
-H 'Content-Type: application/json' \ | |
-H 'Authorization: Bearer ${{ secrets.SPARKEDHOST_TOKEN }}' \ | |
-X POST \ | |
-d '{ | |
"signal": "restart" | |
}' |