Skip to content

Update deployment process #26

Update deployment process

Update deployment process #26

name: Build and deploy
permissions:
id-token: write # Require write permission to Fetch an OIDC token.
on:
push:
branches: [ master ]
# Allow manually triggering deployment
workflow_dispatch:
jobs:
build:
name: Build and deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Set up cache for NPM modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm i --no-audit
- name: Compile to JavaScript
run: npm run build
env:
CI: true
- name: Prune dependencies
run: npm prune --production
- name: Deploy
uses: mojira/deploy@main
with:
azure_client_id: ${{ secrets.AZURE_CLIENT_ID }}
azure_tenant_id: ${{ secrets.AZURE_TENANT_ID }}
azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
bastion_name: ${{ secrets.BASTION_NAME }}
resource_group: ${{ secrets.RESOURCE_GROUP }}
resource_id: ${{ secrets.RESOURCE_ID }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
username: mojiradiscordbot
artifact_paths: |
bin
node_modules
config
*.sh
artifact_destination: /home/mojiradiscordbot/mojira-discord-bot
script: |
cd mojira-discord-bot
./restart.sh main