Skip to content

Commit

Permalink
chore: github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchuzhang committed Sep 14, 2022
1 parent 2ac3c95 commit 2e73730
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 18 deletions.
23 changes: 5 additions & 18 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
kind: pipeline
type: docker
name: default
name: cd

steps:
- name: test
image: liuchuzhang/node-pnpm
commands:
- pnpm install
- pnpm run test

- name: docker-build
image: plugins/docker
settings:
repo: liuchuzhang/blue-music-be
tags: latest
username:
from_secret: docker_username
password:
from_secret: docker_password

- name: deploy
image: appleboy/drone-ssh
environment:
SSH_DEPLOY_SHELL:
from_secret: ssh_deploy_shell
DOCKER_TAG:
from_secret: docker_tag
settings:
host:
from_secret: ssh_host
Expand All @@ -35,8 +21,9 @@ steps:
from_secret: ssh_password
envs:
- ssh_deploy_shell
- docker_tag
script:
- $SSH_DEPLOY_SHELL -d music -e liuchuzhang/blue-music-be -i music-be -p 4001 -u /api
- $SSH_DEPLOY_SHELL -d music -e $DOCKER_TAG -i music-be -p 4001 -u /api

trigger:
branch:
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

env:
NODE_OPTIONS: --max-old-space-size=6144

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test:
name: Run test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: '7'

- name: Set node version
uses: actions/setup-node@v3
with:
node-version: '18'
cache: "pnpm"

- name: Install deps
run: pnpm install

- name: Test
run: pnpm run test

push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Docker Login
uses: docker/login-action@v2.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v3.1.1
with:
context: .
push: true
tags: ${{ secrets.DOCKER_TAG }}

0 comments on commit 2e73730

Please sign in to comment.