Deployment automation (CI)
This commit is contained in:
parent
12d85828e1
commit
bfe8a60b9f
|
@ -1,6 +0,0 @@
|
||||||
on: [push]
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: docker
|
|
||||||
steps:
|
|
||||||
- run: echo All Good
|
|
40
.forgejo/workflows/deploy.yaml
Normal file
40
.forgejo/workflows/deploy.yaml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
name: push
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: docker # ? check what it really means
|
||||||
|
steps:
|
||||||
|
- name: Checkout git repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Astro build
|
||||||
|
uses: withastro/action@v4
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: build
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- name: Get current date
|
||||||
|
id: date
|
||||||
|
run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"
|
||||||
|
- name: Setup SSH
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
chmod 0700 ~/.ssh
|
||||||
|
echo "${{ secrets.SSHPRIVKEY }}" > ~/.ssh/id_ed25519
|
||||||
|
chmod 0600 ~/.ssh/id_ed25519
|
||||||
|
echo "${{ vars.WEBSERVER_IP }} ${{ secrets.SSHPUBKEY }}" >> ~/.ssh/known_hosts
|
||||||
|
chmod 0600 ~/.ssh/known_hosts
|
||||||
|
- name: Push
|
||||||
|
run: |
|
||||||
|
scp -P ${{ secrets.SSHPORT }} -r dist ${{ secrets.SSH_USERNAME }}@${{ vars.WEBSERVER_IP }}:~/oblog-parallels/build-${{ steps.date.outputs.date }}
|
||||||
|
- name: Update symlink
|
||||||
|
run: |
|
||||||
|
ssh ${{ secrets.SSH_USERNAME }}@${{ vars.WEBSERVER_IP }} -p ${{ secrets.SSHPORT }} "cp -r ~/oblog-parallels/build-${{ steps.date.outputs.date }} ~/oblog-parallels/dist"
|
||||||
|
|
Loading…
Reference in a new issue