diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..05dc50c --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,40 @@ +# Builds the resume and publishes it at https://shanaty.ru/resume/ on every push to main (replaces ./deploy-shanaty.sh, which still works by hand). +# The text and the project list are NOT baked into the build: the page reads /data/resume.json, which the server keeps in step with data/resume.json +# in this repository. So a change that only touches data/ or the docs needs no rebuild. +# Gitea runs the workflows of .gitea/workflows INSTEAD of .github/workflows, so the GitHub Pages workflow of the GitHub copy does not run here. +name: deploy-shanaty +on: + push: + branches: [main] + paths-ignore: + - 'data/**' + - '*.md' +jobs: + deploy: + runs-on: ubuntu-latest + container: + image: docker.gitea.com/runner-images:ubuntu-latest + volumes: + - /opt/gitea/site:/site + steps: + - uses: actions/checkout@v4 + - name: Node + run: node --version && npm --version + - name: Install + run: npm ci + - name: Build + run: BASE_PATH=/resume NEXT_PUBLIC_DATA_URL=/data/resume.json NEXT_PUBLIC_SITE_ORIGIN= npm run build + - name: Check the build + run: test -f out/index.html + - name: Publish (the folder is swapped in, so the site is never half-updated) + run: | + set -e + cd /site + rm -rf .resume.new .resume.old + mkdir .resume.new + cp -r "$GITHUB_WORKSPACE"/out/. .resume.new/ + chmod -R a+rX .resume.new + if [ -d resume ]; then mv resume .resume.old; fi + mv .resume.new resume + rm -rf .resume.old + echo "Published: https://shanaty.ru/resume/"