Deploy #791
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- develop | |
- main | |
paths: | |
- back/** | |
- web/** | |
- deploy/** | |
- common/** | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}" | |
cancel-in-progress: false | |
jobs: | |
deployment: | |
runs-on: ubuntu-latest | |
environment: production | |
concurrency: production | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set variables | |
run: | | |
if [[ "${{ github.base_ref }}" == "main" || "${{github.ref}}" == "refs/heads/main" ]]; then | |
echo "project=liane" >> $GITHUB_ENV | |
echo "branch=main" >> $GITHUB_ENV | |
fi | |
if [[ "${{ github.base_ref }}" == "develop" || "${{github.ref}}" == "refs/heads/develop" ]]; then | |
echo "project=liane-dev" >> $GITHUB_ENV | |
echo "branch=develop" >> $GITHUB_ENV | |
fi | |
- name: Deploy on server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USER }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
set -e | |
cd ~ | |
git clone -b "${{ env.branch }}" [email protected]:oxymore-tech/liane.git "${{ env.project }}" || true; | |
cd "${{ env.project }}/deploy" | |
git pull | |
./liane test | |
./liane start | |
- name: Copy test results | |
uses: nicklasfrahm/scp-action@main | |
if: always() | |
with: | |
direction: download | |
insecure_ignore_fingerprint: true | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USER }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
source: "/tmp/it-${{ env.project }}/test-results.trx" | |
target: "test-results.trx" | |
- name: Copy e2e results | |
uses: nicklasfrahm/scp-action@main | |
if: always() | |
with: | |
direction: download | |
insecure_ignore_fingerprint: true | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USER }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
source: "/tmp/e2e-${{ env.project }}/junit.xml" | |
target: "e2e-junit.xml" | |
- name: Test report | |
uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: Integration tests | |
path: "test-results.trx" | |
reporter: dotnet-trx | |
fail-on-error: true | |
- name: e2e test report | |
uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: e2e tests | |
path: e2e-junit.xml | |
reporter: jest-junit |