mirror of
https://github.com/Cameri/nostream.git
synced 2025-04-12 05:39:06 +02:00
chore(ci): deploy after release (#55)
This commit is contained in:
parent
0c5c9a1e8f
commit
46f7fa7068
3
.github/workflows/checks.yml
vendored
3
.github/workflows/checks.yml
vendored
@ -3,7 +3,8 @@ name: CI Checks
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
||||
|
95
.github/workflows/release.yml
vendored
95
.github/workflows/release.yml
vendored
@ -4,79 +4,13 @@ on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:18-alpine3.16
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: npm
|
||||
- name: Install package dependencies
|
||||
run: npm ci
|
||||
- name: Run ESLint
|
||||
run: npm run lint
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:18-alpine3.16
|
||||
needs: [lint]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: npm
|
||||
- name: Install package dependencies
|
||||
run: npm ci
|
||||
- name: Run ESLint
|
||||
run: npm run build
|
||||
test:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:18-alpine3.16
|
||||
needs: [build]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: npm
|
||||
- name: Install package dependencies
|
||||
run: npm ci
|
||||
- name: Run tests
|
||||
run: npm run test:unit
|
||||
coverage:
|
||||
name: Coverage
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:18-alpine3.16
|
||||
needs: [build]
|
||||
environment: development
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: npm
|
||||
- name: Install package dependencies
|
||||
run: npm ci
|
||||
- name: Run coverage
|
||||
run: npm run cover
|
||||
build-and-push-image:
|
||||
name: Build and push container image
|
||||
runs-on: ubuntu-latest
|
||||
needs: [coverage, test]
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
@ -101,3 +35,26 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
deploy:
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
environment: deployment
|
||||
env:
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup SSH key
|
||||
run: |
|
||||
ssh-agent -t 60 -a $SSH_AUTH_SOCK > /dev/null
|
||||
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}"
|
||||
- name: Setup known hosts
|
||||
run: mkdir -p ~/.ssh && chmod 700 ~/.ssh && ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
||||
- name: Setup SSH config
|
||||
run: |
|
||||
mkdir -p ~/.ssh/sockets && chmod 700 ~/.ssh/sockets
|
||||
echo "Host *\n User ${{ secrets.SSH_USER }}\n ForwardAgent yes\n ControlMaster auto\n ControlPath ~/.ssh/sockets/%r@%h-%p\n ControlPersist 600" >> ~/.ssh/config
|
||||
chmod 600 ~/.ssh/config
|
||||
- name: Deploy
|
||||
run: |
|
||||
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} -o SendEnv=GITHUB_REF_NAME "cd /srv/nostr-ts-relay && git fetch -va origin && git checkout --progress --force -B $GITHUB_REF_NAME refs/remotes/origin/$GITHUB_REF_NAME && source ~/.nvm/nvm.sh && nvm use && npm run tor:docker:compose:start -- --detach"
|
||||
|
@ -8,11 +8,10 @@ services:
|
||||
DB_USER: nostr_ts_relay
|
||||
DB_PASSWORD: nostr_ts_relay
|
||||
DB_NAME: nostr_ts_relay
|
||||
DB_MIN_POOL_SIZE: 1
|
||||
DB_MAX_POOL_SIZE: 2
|
||||
DB_MIN_POOL_SIZE: 2
|
||||
DB_MAX_POOL_SIZE: 10
|
||||
NOSTR_CONFIG_DIR: /home/node/
|
||||
PORT: 8008
|
||||
DEBUG: worker:event-message-handler,worker:web-socket-server-adapter
|
||||
user: node:node
|
||||
volumes:
|
||||
- $HOME/.nostr:/home/node/
|
||||
|
Loading…
x
Reference in New Issue
Block a user