This commit is contained in:
2021-10-06 10:23:17 +02:00
parent 3f10ab47fb
commit 9dabdeb36e
48 changed files with 3694 additions and 56 deletions

View File

@@ -8,6 +8,8 @@ on:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
@@ -15,67 +17,62 @@ jobs:
contents: read
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
- run: mkdir ./target
- run: mkdir ./target
- name: Build with Maven
run: mvn -f tapas-tasks/pom.xml --batch-mode --update-snapshots verify
- run: cp ./tapas-tasks/target/tapas-tasks-0.0.1-SNAPSHOT.jar ./target
- name: Build with Maven
run: mvn -f tapas-tasks/pom.xml --batch-mode --update-snapshots verify
- run: cp ./tapas-tasks/target/tapas-tasks-0.0.1-SNAPSHOT.jar ./target
- name: Build with Maven
run: mvn -f app/pom.xml --batch-mode --update-snapshots verify
- run: cp ./app/target/app-0.1.0.jar ./target
- name: Build with Maven
run: mvn -f app/pom.xml --batch-mode --update-snapshots verify
- run: cp ./app/target/app-0.1.0.jar ./target
- run: cp ./.deployment/docker-compose.yml ./target
- name: Archive artifacts
uses: actions/upload-artifact@v1
with:
name: app
path: ./target/
- run: cp docker-compose.yml ./target
- name: Archive artifacts
uses: actions/upload-artifact@v1
with:
name: app
path: ./target/
deploy:
runs-on: ubuntu-latest
needs: [build, ]
needs: [build]
steps:
- name: Download app artifacts
uses: actions/download-artifact@v1
with:
name: app
- name: Copy host via scp
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.SSH_HOST }}
USERNAME: ${{ secrets.SSH_USER }}
PORT: 22
KEY: ${{ secrets.SSH_PRIVATE_KEY }}
with:
source: "app/*"
target: "/home/${{ secrets.SSH_USER }}/"
strip_components: 1
rm: false
overwrite: true
- name: Download app artifacts
uses: actions/download-artifact@v1
with:
name: app
- name: Copy host via scp
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.SSH_HOST }}
USERNAME: ${{ secrets.SSH_USER }}
PORT: 22
KEY: ${{ secrets.SSH_PRIVATE_KEY }}
with:
source: "app/*"
target: "/home/${{ secrets.SSH_USER }}/"
strip_components: 1
rm: false
overwrite: true
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
USERNAME: ${{ secrets.SSH_USER }}
PORT: 22
KEY: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/${{ secrets.SSH_USER }}/
touch acme.json
sudo chmod 0600 acme.json
sudo echo "PUB_IP=$(wget -qO- http://ipecho.net/plain | xargs echo)" | sed -e 's/\./-/g' > .env
sudo docker-compose up -d
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
USERNAME: ${{ secrets.SSH_USER }}
PORT: 22
KEY: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/${{ secrets.SSH_USER }}/
touch acme.json
sudo chmod 0600 acme.json
sudo echo "PUB_IP=$(wget -qO- http://ipecho.net/plain | xargs echo)" | sed -e 's/\./-/g' > .env
sudo docker-compose up -d