S3BzA at pull_request event #74
Workflow file for this run
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: Deployment | |
run-name: ${{ github.actor }} at ${{ github.event_name }} event | |
on: | |
workflow_dispatch: | |
# fork: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Create api.env file | |
run: echo "${{ secrets.API_ENV }}" > api.env | |
- name: Create fe.env file | |
run: echo "${{ secrets.FE_ENV }}" > fe.env | |
- name: Create db.env file | |
run: echo "${{ secrets.DB_ENV }}" > db.env | |
- name: Create red.env file | |
run: echo "${{ secrets.RED_ENV }}" > red.env | |
- name: Tar the repo | |
run: | | |
cd $GITHUB_WORKSPACE | |
mkdir temp | |
rsync -a . ./temp | |
tar -czpvf archive.tar.gz -C ./temp . | |
continue-on-error: true | |
- name: Ensure Tarball exists | |
run: | | |
cd $GITHUB_WORKSPACE | |
ls | |
continue-on-error: true | |
- name: Set up WireGuard Connection | |
uses: niklaskeerl/easy-wireguard-action@v2 | |
with: | |
WG_CONFIG_FILE: ${{ secrets.WG_CONFIG_FILE }} | |
- name: Send through the docker container using scp | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: ${{ secrets.SSH_PORT }} | |
source: "archive.tar.gz" | |
target: ./ | |
timeout: 3m | |
overwrite: true | |
- name: Spin up docker image | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: ${{ secrets.SSH_PORT }} | |
# extract to a temporary folder for extration | |
script: | | |
rm -rf repo | |
mkdir repo | |
tar -xzvf archive.tar.gz -C repo | |
cd repo | |
docker compose down | |
docker builder prune -a -f | |
docker compose build --progress=plain | |
docker compose up -d |