This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
server/.github/workflows/build_deploy_dev.yml
2005 d20f118a0c
Some checks failed
build and publish docker image / deploy / build (push) Failing after 1m43s
typo fox: added / to setup ssh action
2024-06-01 18:48:27 +02:00

65 lines
1.8 KiB
YAML

name: build and publish docker image / deploy
on:
push:
branches: ["dev"]
pull_request:
branches: ["dev"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Restore cached Primes
id: maven-cache-restore
uses: https://github.com/actions/cache/restore@v4
with:
path: |
path/to/dependencies
some/other/dependencies
key: ${{ runner.os }}-maven
- uses: https://github.com/actions/checkout@v4
with:
repository: 'learningpulse/server'
ref: 'dev'
token: '${{ secrets.token }}'
- name: 'Set up java 22'
uses: https://github.com/actions/setup-java@v4
with:
java-version: "22"
distribution: "temurin"
- name: Setup maven
if: steps.maven-cache.outputs.cache-hit != 'true'
uses: https://github.com/stCarolas/setup-maven@v5
with:
maven-version: 3.9.6
- name: Build with Maven
run: mvn -Dtoken=${{ secrets.token }} clean compile jib:build -e
- name: Cache local Maven repository
uses: https://github.com/actions/cache/save@v4
id: maven-cache-save
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven
- name: Setup SSH
uses: https://github.com/LuisEnMarroquin/setup-ssh-action@v2.0.0
with:
ORIGIN: ${{ secrets.HOST }} # example.com || 8.8.8.8
SSHKEY: ${{ secrets.SSH }} # ----- BEGIN RSA PRIVATE KEY----- ...
NAME: dev
PORT: ${{ secrets.PORT }} # 3000
USER: ${{ secrets.USER }} # admin
# pull and deploy latest images
- run: ssh dev "cd services/server && docker compose pull && docker compose up -d";