Skip to content

test another ws url #11

test another ws url

test another ws url #11

name: "Deploy Test-App on SNEK"
on:
push:
branches:
- feature
jobs:
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
- name: Build Frontend
run: |
cd frontend
npm install
npm run build
- uses: actions/upload-artifact@v2
with:
name: frontend-build
path: frontend/dist/
build-backend:
runs-on: ubuntu-latest
needs: build-frontend
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '20'
distribution: 'adopt'
cache: 'maven'
- uses: actions/download-artifact@v2
with:
name: frontend-build
path: backend/src/main/resources/static
- name: Build with maven
run: mvn -B package --file backend/pom.xml
- uses: actions/upload-artifact@v2
with:
name: app.jar
path: backend/target/netrunner.jar
push-to-docker-hub:
runs-on: ubuntu-latest
needs: build-backend
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: app.jar
path: backend/target
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: toshymoshy
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/arm64
tags: toshymoshy/netrunner:aarch64-test
context: .
deploy:
runs-on: ubuntu-latest
needs: push-to-docker-hub
steps:
- name: Restart docker container
uses: appleboy/ssh-action@master
with:
host: snekhome.click
port: ${{ secrets.SSH_PORT_SNEK }}
username: ${{ secrets.SSH_USERNAME_SNEK }}
password: ${{ secrets.SSH_PASSWORD_SNEK }}
script: |
docker stop netrunner-test
docker rm netrunner-test
docker run --pull=always --name netrunner-test -p 8081:8080 --restart always --detach --env MONGO_DB_URI="${{ secrets.MONGO_DB_URI_TEST }}" --env MAPBOX_ACCESS_TOKEN="${{ secrets.MAPBOX_ACCESS_TOKEN }}" --env GOOGLE_API_KEY="${{ secrets.GOOGLE_API_KEY }}" toshymoshy/netrunner:aarch64-test
sleep 15s
docker logs netrunner-test
- name: Check the deployed service URL
uses: jtalk/url-health-check-action@v3
with:
url: http://test.snekhome.click
max-attempts: 3
retry-delay: 5s
retry-all: true