diff --git a/.gitea/workflows/hugo.yaml b/.gitea/workflows/hugo.yaml index b365a86..698df9a 100644 --- a/.gitea/workflows/hugo.yaml +++ b/.gitea/workflows/hugo.yaml @@ -22,14 +22,37 @@ jobs: - name: Setup Hugo uses: https://github.com/peaceiris/actions-hugo@v2 with: - hugo-version: '0.122.0' + hugo-version: '0.124.0' # extended: true - name: Build site run: hugo --minify - # - name: Create tarfile - # run: tar -cf website.tar public + # -C switch means cd to public and then tar all contents + - name: Create tarfile + run: tar -cf website.tar -C public . + + - name: Setup ssh + env: + SSH_AUTH_SOCK: /tmp/ssh_agent.sock + run: | + mkdir -p /home/runner/.ssh + ssh-keyscan ${{secrets.SSH_HOST}} >> /home/runner/.ssh/known_hosts + echo "${{ secrets.SSH_KEY }}" > /home/runner/.ssh/id_rsa + chmod 600 /home/runner/.ssh/id_rsa + ssh-agent -a $SSH_AUTH_SOCK > /dev/null + ssh-add /home/runner/.ssh/id_rsa + + - name: Deploy to server + env: + SSH_AUTH_SOCK: /tmp/ssh_agent.sock + run: | + scp ./website.tar ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{SCP_DEST}} + ssh ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} 'rm -r ${{WEB_DIR}}/*' + ssh ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} 'tar -xf ${{SCP_DEST}}/website.tar --directory ${{WEB_DIR}}/' + ssh ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} 'rm ${{SCP_DEST}}/website.tar' + + # - name: Create release # id: create-release @@ -39,15 +62,15 @@ jobs: # website.tar # api_key: '${{secrets.RELEASE_TOKEN}}' - # - name: Upload artifacts - # uses: actions/upload-artifact@v3 - # with: - # name: website-files.tar - # path: website.tar + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: website-files.tar + path: website.tar - - name: Setup Minio client - run: wget https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x ./mc && ./mc alias set deploy ${{ secrets.S3_ENDPOINT }} ${{ secrets.S3_ACCESS_KEY }} ${{ secrets.S3_SECRET_KEY }} - - - name: Deploy to Garage - run: ./mc mirror --remove --overwrite ./public/ deploy/${{ secrets.S3_BUCKET }} + # - name: Setup Minio client + # run: wget https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x ./mc && ./mc alias set deploy ${{ secrets.S3_ENDPOINT }} ${{ secrets.S3_ACCESS_KEY }} ${{ secrets.S3_SECRET_KEY }} + # + # - name: Deploy to Garage + # run: ./mc mirror --remove --overwrite ./public/ deploy/${{ secrets.S3_BUCKET }} diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml deleted file mode 100644 index 308471b..0000000 --- a/.gitea/workflows/release.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: release - -on: - push: - tags: - - '*' - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true # Fetch Hugo themes (true OR recursive) - fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - - name: setup go - uses: https://github.com/actions/setup-go@v4 - with: - go-version: '>=1.20.1' - - - name: Setup Hugo - uses: https://github.com/peaceiris/actions-hugo@v2 - with: - hugo-version: '0.111.3' - # extended: true - - - name: Build site - run: hugo --minify - - - name: Create tarfile - run: tar -cf website.tar public - - - name: Create relesase - id: create-release-action - uses: https://gitea.com/actions/release-action@main - with: - files: |- - website.tar - api_key: '${{secrets.RELEASE_TOKEN}}'