From de46390dc58133170ee3782a0dba769e75d2cec1 Mon Sep 17 00:00:00 2001 From: augusthottie Date: Thu, 15 Aug 2024 22:21:22 +0200 Subject: [PATCH] added csharp-boilerplater workflow --- .../workflows/kimiko-csharp-deployment.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/kimiko-csharp-deployment.yaml diff --git a/.github/workflows/kimiko-csharp-deployment.yaml b/.github/workflows/kimiko-csharp-deployment.yaml new file mode 100644 index 000000000..262c86531 --- /dev/null +++ b/.github/workflows/kimiko-csharp-deployment.yaml @@ -0,0 +1,58 @@ +name: Kimiko Csharp Deployment + +on: + workflow_dispatch: + workflow_run: + workflows: ["Build and Upload"] + types: + - completed + +jobs: + deploy_boilerplate_frontend: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + environment: + name: "kimiko-csharp" + url: ${{ vars.URL }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + name: boilerplate-build + path: . + + - name: Create .env + uses: vicradon/create-env-action@v1.0.1 + with: + action_input_file: ".env.sample" + action_output_file: ".env" + API_URL: ${{ vars.API_URL }} + NEXTAUTH_URL: ${{ vars.URL }} + + - name: Copy Artifacts to server + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + source: ".env,boilerplate.tar.gz" + target: "~/deployments/hng_boilerplate_nextjs" + + - name: Deploy on server + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + script: | + cd ~/deployments/hng_boilerplate_nextjs + tar -xzf boilerplate.tar.gz + rm -f boilerplate.tar.gz + pm2 restart boilerplate-frontend --update-env