From eac9dbb27d3fe9ab66fff1a411d03604bdc04f6b Mon Sep 17 00:00:00 2001 From: Marc Riera Date: Sat, 17 Feb 2024 18:12:04 +0100 Subject: [PATCH] Add Forgejo actions --- .forgejo/workflows/build.yaml | 36 +++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 25 ------------------------ .gitmodules | 2 +- 3 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 .forgejo/workflows/build.yaml delete mode 100644 .gitlab-ci.yml diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 0000000..272dc10 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,36 @@ +name: publish + +on: + push: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + env: + SSH_PRIVATE_KEY: ${{ secrets.PUBLISHER_PRIVATE_KEY }} + SSH_HOST: ${{ secrets.PUBLISHER_HOST }} + SSH_PORT: ${{ secrets.PUBLISHER_PORT }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 # all history for all branches and tags\ + + - name: Install Hugo + run: | + apt update && apt install -y hugo + + - name: Build + run: | + hugo --minify + + - name: Deploy + run: | + eval $(ssh-agent -s) + echo "$SSH_PRIVATE_KEY" | ssh-add - + apt update && apt install -y rsync + mkdir ~/.ssh + ssh-keyscan -p $SSH_PORT $SSH_HOST > ~/.ssh/known_hosts + rsync -atv --progress --delete -e "ssh -p $SSH_PORT" ./public/ publisher@$SSH_HOST:/usr/share/nginx/html/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 80125d0..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,25 +0,0 @@ -image: monachus/hugo - -variables: - GIT_SUBMODULE_STRATEGY: recursive - -before_script: - - apt-get update - - apt-get --yes install rsync - -build: - stage: build - script: - - hugo - artifacts: - paths: - - public - only: - - master - -deploy: - stage: deploy - script: - - rsync -hrv --delete public/ /var/opt/gitlab-runner/builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/ - only: - - master diff --git a/.gitmodules b/.gitmodules index 6923a81..6afbb20 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "themes/kozmo-dark"] path = themes/kozmo-dark - url = https://gitlab.com/MarcRiera/kozmo-dark.git + url = https://git.marcriera.cat/marc/kozmo-dark.git