CI/CD?
This commit is contained in:
parent
35f9f59b33
commit
7cf59283d4
1 changed files with 35 additions and 0 deletions
35
.forgejo/workflows/deploy.yaml
Normal file
35
.forgejo/workflows/deploy.yaml
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: Deploy to Web Server
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master # Matches all branches
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref_name }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Setup SCP
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
||||
chmod -R go-rwx ~/.ssh
|
||||
ssh-keyscan -H ${{ vars.SERVER_HOST }} >> ~/.ssh/known_hosts
|
||||
echo "Deploying to ${{ vars.SERVER_HOST }} as ${{ vars.SERVER_USER }} to /var/www/${{ github.ref_name }}"
|
||||
|
||||
- name: Debug SSH Connection
|
||||
run: ssh -v -o PasswordAuthentication=no -i ~/.ssh/id_ed25519 ${{ vars.SERVER_USER }}@${{ vars.SERVER_HOST }} echo "SSH Connection Successful"
|
||||
|
||||
- name: create folder if not exists
|
||||
run: |
|
||||
ssh -i ~/.ssh/id_ed25519 ${{ vars.SERVER_USER }}@${{ vars.SERVER_HOST }} "mkdir -p /var/www/ariexpress/${{ github.ref_name }}"
|
||||
|
||||
- name: Deploy via SCP
|
||||
run: |
|
||||
scp -i ~/.ssh/id_ed25519 -rv ./* ${{ vars.SERVER_USER }}@\[${{ vars.SERVER_HOST }}\]:/var/www/ariexpress/${{ github.ref_name }}
|
Loading…
Add table
Add a link
Reference in a new issue