first commit
All checks were successful
Build,test and deploy iamstephan.info / deploy-prod (push) Successful in 18s
All checks were successful
Build,test and deploy iamstephan.info / deploy-prod (push) Successful in 18s
This commit is contained in:
commit
a90d2a528d
14 changed files with 369 additions and 0 deletions
39
.github/workflows/deploy.yml
vendored
Normal file
39
.github/workflows/deploy.yml
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
name: Build,test and deploy iamstephan.info
|
||||
run-name: ${{ gitea.actor }} is building, testing and deploying the static page
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy-prod:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo "The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
- name: Install apt packages
|
||||
run: apt update && apt install -y jq rsync
|
||||
- name: Get latest Hugo version
|
||||
run: |
|
||||
url=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | jq -r '.assets[] | select(.name | contains("linux-amd64.tar.gz")) | .browser_download_url' | grep -E 'hugo_[0-9]+\.[0-9]+\.[0-9]+_linux-amd64.tar.gz')
|
||||
wget -P /tmp/hugo/ "$url"
|
||||
version=$(echo "$url" | grep -oP 'hugo_\K[0-9]+\.[0-9]+\.[0-9]+')
|
||||
echo "Downloaded Hugo version: $version"
|
||||
- name: Unpack Hugo
|
||||
run: tar -xf /tmp/hugo/* -C ${{ gitea.workspace }}/bin
|
||||
- name: Build the static webpage
|
||||
run: ${{ gitea.workspace }}/bin/hugo --minify
|
||||
- name: Test static page
|
||||
run: bash ${{ gitea.workspace }}/bin/test_static_page.sh
|
||||
- name: Create private key
|
||||
run: |
|
||||
echo "${{ secrets.ACT_RUNNER_KEY }}" > /tmp/act_runner_key
|
||||
chmod 600 /tmp/act_runner_key
|
||||
- name: rsync public directory
|
||||
run: |
|
||||
/usr/bin/rsync -avz --delete -e "ssh -i /tmp/act_runner_key -o StrictHostKeyChecking=no" ${{ gitea.workspace }}/public/* root@vps03.hadan-it.com:/opt/npm/webspace/preview.hadan-it.com/hugo-goa-demo/
|
||||
- run: echo "This job's status is ${{ job.status }}."
|
Loading…
Add table
Add a link
Reference in a new issue