myResume2/.forgejo/workflows/create-release.yml
Blade34242 b0a1c19349
Some checks failed
Node CI / lint (push) Waiting to run
Create Forgejo release / package-and-release (push) Has been cancelled
feat: add client-side PDF and Forgejo release flow
2026-07-27 17:37:24 +07:00

40 lines
1.7 KiB
YAML

name: Create Forgejo release
on:
push:
tags: ['v*.*.*']
jobs:
package-and-release:
# This label only needs Node 22, Git, tar, and curl. Docker is not required.
runs-on: node-22
steps:
- name: Check out source
uses: https://data.forgejo.org/actions/checkout@v6
with:
fetch-depth: 0
- name: Create release archive and checksum
run: |
mkdir -p dist
ARCHIVE="my-resume2-${FORGEJO_REF_NAME}.tar.gz"
git archive --format=tar.gz --prefix="my-resume2-${FORGEJO_REF_NAME}/" -o "dist/${ARCHIVE}" "$FORGEJO_SHA"
sha256sum "dist/${ARCHIVE}" > "dist/${ARCHIVE}.sha256"
- name: Create the Forgejo release
run: |
cat > release.json <<EOF
{"tag_name":"${FORGEJO_REF_NAME}","target_commitish":"${FORGEJO_SHA}","name":"${FORGEJO_REF_NAME}","body":"Local Docker deployment package. Build it on the target server with docker compose; no container image is published.","draft":false,"prerelease":false}
EOF
curl --fail --request POST \
--header "Authorization: token ${FORGEJO_TOKEN}" \
--header "Content-Type: application/json" \
--data @release.json \
"${FORGEJO_SERVER_URL}/api/v1/repos/${FORGEJO_REPOSITORY}/releases" > created-release.json
- name: Upload release files
run: |
RELEASE_ID=$(node -p "require('./created-release.json').id")
for FILE in dist/*; do
curl --fail --request POST \
--header "Authorization: token ${FORGEJO_TOKEN}" \
--upload-file "$FILE" \
"${FORGEJO_SERVER_URL}/api/v1/repos/${FORGEJO_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename "$FILE")"
done