commit 076845d0ea75b2bdb73323fc66c56c4d183f2eb9 Author: Mateusz Pstrucha Date: Mon Oct 19 22:45:46 2026 +0200 Site content and deployment for ig.mtps.pl Builds mtps/folio at a pinned tag against this repo's photos/ and profile/ and deploys the release with ygg/static-server, taking over the stack that was released from mtps/folio. Co-Authored-By: Claude Opus 5.5 diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..afb97df --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,107 @@ +name: Release + +# v1.2.3 -> build folio@FOLIO_REF against this repo's photos/ and profile/, +# release ig.mtps.pl-1.2.3.tgz, deploy/static.yml (ig.mtps.pl) +on: + push: + tags: ['v*'] + +env: + # folio version the site is built with, bump to pick up app changes + FOLIO_REF: v0.2.0 + +jobs: + release: + runs-on: rocky-10 + outputs: + version: ${{ steps.meta.outputs.version }} + steps: + - name: Check out content + uses: actions/checkout@v4 + + - name: Check out folio + uses: actions/checkout@v4 + with: + repository: mtps/folio + ref: ${{ env.FOLIO_REF }} + path: folio + + - name: Derive version + id: meta + run: | + VERSION="${GITHUB_REF_NAME#v}" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "$VERSION" + + # Version comes from the packageManager field in folio's package.json. + - name: Set up pnpm + uses: pnpm/action-setup@v4 + with: + package_json_file: folio/package.json + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 24 + cache: pnpm + cache-dependency-path: folio/pnpm-lock.yaml + + - name: Install dependencies + working-directory: folio + run: pnpm install --frozen-lockfile + + - name: Type check + working-directory: folio + run: FOLIO_CONTENT="$GITHUB_WORKSPACE" pnpm check + + - name: Build + working-directory: folio + run: FOLIO_CONTENT="$GITHUB_WORKSPACE" pnpm build + + # Originals carry EXIF (GPS, exact time); only resized copies may ship. + - name: Check published images for EXIF + working-directory: folio + run: pnpm check:metadata + + - name: Create release archive + env: + VERSION: ${{ steps.meta.outputs.version }} + run: | + NAME="${{ gitea.event.repository.name }}-${VERSION}.tgz" + # Archive the *contents* of dist/ rather than dist/ itself, so it + # untars straight into a web root. + tar -czf "$NAME" -C folio/dist . + sha256sum "$NAME" > "$NAME.sha256" + + - name: Create release + uses: akkuman/gitea-release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + server_url: ${{ gitea.server_url }} + tag_name: ${{ gitea.ref_name }} + name: ${{ gitea.ref_name }} + files: |- + ${{ gitea.event.repository.name }}-*.tgz + ${{ gitea.event.repository.name }}-*.tgz.sha256 + + # static-server on kara downloads the release asset, so this runs after it + deploy: + needs: release + runs-on: rocky-10 + # never run two deploys at once + concurrency: + group: deploy-${{ gitea.repository }} + cancel-in-progress: false + steps: + - name: Check out source + uses: actions/checkout@v4 + + - name: Deploy + uses: https://git.app.ygg/ygg/actions/deploy@v2 + with: + type: static + dist-path: deploy/static.yml + extra-vars: | + static_release=${{ needs.release.outputs.version }} + ssh-key: ${{ secrets.DEPLOY_SSH_KEY }} + known-hosts: ${{ vars.DEPLOY_KNOWN_HOSTS }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5242a4a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# local folio checkout/build output, if any +folio/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..72f3787 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# ig.mtps.pl + +The photos at [ig.mtps.pl](https://ig.mtps.pl). This repo is only content and deployment; the site itself is [folio](https://git.app.ygg/mtps/folio). + +## Adding a photo + +1. Export it to `photos/.jpg`, about 2048px on the long edge, cropped however you like. The slug becomes the URL, `/p/`; starting it with the date (`2026-10-12-tatry`) keeps the folder sorted. +2. Optionally add `photos/.yml` with a `description`, `alt`, `taken` or `location`. The format is in [folio's README](https://git.app.ygg/mtps/folio#content). +3. Commit, then release: `git tag v1.2.3 && git push --follow-tags`. + +The name, bio, link and avatar are in `profile/`. + +## Preview + +```sh +cd ../folio && pnpm install && FOLIO_CONTENT=../ig.mtps.pl pnpm dev +``` + +## Release and deploy + +Pushing a `v*` tag runs `.gitea/workflows/release.yml`: + +1. It builds folio at `FOLIO_REF` (set in the workflow) against this repo's content, checks that no published image has EXIF location or time, and attaches `ig.mtps.pl-.tgz` to a Gitea release. +2. `ygg/actions/deploy@v2` (SSH to kara, Ansible `deploy/static`) then runs static-server for that release on port 11904, behind ig.mtps.pl. + +To pick up folio changes, bump `FOLIO_REF` and tag a new release. diff --git a/deploy/static.yml b/deploy/static.yml new file mode 100644 index 0000000..6a1fc6e --- /dev/null +++ b/deploy/static.yml @@ -0,0 +1,38 @@ +--- +# Static site: https://git.app.ygg/mtps/ig.mtps.pl, built with mtps/folio +# +# Deployed by .gitea/workflows/release.yml through ygg/actions/deploy +# (deploy/static playbook on kara). +# +# static_release is passed by the release workflow (-e static_release=1.2.3). +# For a manual run pass it the same way, there's deliberately no default here. +# Release assets are versioned (ig.mtps.pl-.tgz), and static-server +# only auto-detects *.tar.gz, so the asset is named explicitly. + +# kept from when the site was released from mtps/folio, so deploys update +# that stack instead of starting a second one on the same port +static_stack_name: folio + +domain: ig.mtps.pl +# /etc/nginx/certs/.conf on the nginx host +cert: mtps.pl + +# static_service replaces the role default as a whole, so every key is required +static_service: + name: static + image: "{{ gitea_host }}/ygg/static-server:latest" + environment: + GITEA_REPOSITORY_URL: "https://{{ gitea_host }}/mtps/ig.mtps.pl" + GITEA_RELEASE: "v{{ static_release }}" + GITEA_ASSET_NAME: "ig.mtps.pl-{{ static_release }}.tgz" + SSL_CERT_FILE: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem + volumes: + - /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:ro + ports: + - target: 8080 + published: 11904 + protocol: tcp + mode: ingress + replicas: 3 + restart_policy: + condition: on-failure diff --git a/profile/profile.yml b/profile/profile.yml new file mode 100644 index 0000000..f5fda37 --- /dev/null +++ b/profile/profile.yml @@ -0,0 +1,7 @@ +# Shown at the top of the page. Drop avatar.jpg (or .png/.webp) next to +# this file for a profile picture; without one the initial is shown. +name: mtps +bio: Photos I'm happy with. +link: + url: https://www.mtps.pl + label: mtps.pl