48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: ['main']
|
|
pull_request:
|
|
branches: ['main']
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ secrets.DOCKER_REGISTRY }}
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Build the Docker image
|
|
run: |
|
|
docker build . --file Dockerfile --tag registry.ctdn.net/spring-web-api:latest
|
|
docker push registry.ctdn.net/spring-web-api:latest
|
|
|
|
deploy:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Cloning repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Push to dokku
|
|
uses: dokku/github-action@master
|
|
with:
|
|
git_remote_url: 'ssh://dokku@heroku.ctdn.net:2222/spring-web-modules'
|
|
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
branch: main
|
|
git_push_flags: --force
|