Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create phoenix-deployment.yml #1447

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/phoenix-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Pheonix Deployment

on:
workflow_run:
workflows: ["Build and Upload"]
types:
- completed

jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

environment:
name: "panther-expressjs"
url: ${{ vars.URL }}

steps:
- 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: Decode ENV secret
run: |
echo "${{ secrets.ENV }}" > encoded_env.txt
base64 -d encoded_env.txt > .env.expressjs

- name: Copy Artifacts to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: ".env.expressjs,boilerplate.tar.gz"
target: "/tmp/expressjs"

- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd hng_boilerplate_nextjs
tar -xzf /tmp/expressjs/boilerplate.tar.gz
mv /tmp/java/.env.expressjs .env
rm -f /tmp/expressjs/boilerplate.tar.gz
cp -r .next/standalone/* .
pm2 restart nextjs_boilerplate --update-env
Loading