8 Commits

Author SHA1 Message Date
a8b83564d9 check for tag before releasing
Some checks failed
Backend Actions / check (push) Successful in 12s
Backend Actions / build (push) Successful in 22s
Backend Actions / package (push) Failing after 17s
Backend Actions / test (push) Successful in 30s
2025-07-25 15:01:16 +01:00
86d5e8f66a check for tag before releasing 2025-07-25 14:44:51 +01:00
7ba9cd2c73 add cache to release
All checks were successful
Backend Actions / check (push) Successful in 12s
Backend Actions / build (push) Successful in 22s
Backend Actions / test (push) Successful in 32s
Backend Actions / package (push) Successful in 1m26s
2025-07-25 14:28:04 +01:00
bec8abfe47 use rust latest image
Some checks failed
Backend Actions / check (push) Successful in 14s
Backend Actions / build (push) Successful in 26s
Backend Actions / test (push) Successful in 37s
Backend Actions / package (push) Failing after 1m23s
2025-07-25 14:21:45 +01:00
7fcae49700 use node 24
Some checks failed
Backend Actions / check (push) Successful in 13s
Backend Actions / build (push) Successful in 24s
Backend Actions / test (push) Successful in 33s
Backend Actions / package (push) Failing after 1m43s
2025-07-25 14:04:26 +01:00
b561c92f07 use npm rather than pnpm
Some checks failed
Backend Actions / check (push) Successful in 18s
Backend Actions / build (push) Successful in 31s
Backend Actions / test (push) Successful in 41s
Backend Actions / package (push) Failing after 27s
2025-07-25 13:39:24 +01:00
38cac0b257 use rust-webapp image for release
Some checks failed
Backend Actions / check (push) Successful in 48s
Backend Actions / test (push) Successful in 45s
Backend Actions / package (push) Failing after 7s
Backend Actions / build (push) Successful in 1m6s
2025-07-25 10:54:29 +01:00
5b08ca0dd2 add initial release workflow
Some checks failed
Backend Actions / check (push) Successful in 1m47s
Backend Actions / package (push) Failing after 9s
Backend Actions / build (push) Successful in 2m28s
Backend Actions / test (push) Successful in 2m52s
2025-07-25 09:39:37 +01:00
6 changed files with 96 additions and 62 deletions

View File

@ -0,0 +1,74 @@
name: Backend Actions
run-name: ${{ gitea.actor }} is running backend actions
on: [push]
# push:
# tags:
# - 'v[0-9]+\.[0-9]+\.[0-9]+'
jobs:
package:
runs-on: rust-latest
depends-on: ["check-tag"]
steps:
- uses: actions/checkout@v4
- name: Check for Tag
run: |-
TAGS="$(git tag --points-at HEAD)"
if [ -n $TAGS ]; then
TAG=$(echo "$TAGS" | grep -E '^v[0-9]+.[0-9]+.[0-9]+$' | sort -V | tail -1)
echo "RELEASE_TAG=$TAG" >> "$GITHUB_ENV"
else
echo "No release tag found"
fi
- name: Create Output Directory
if: ${{ env.RELEASE_TAG != "" }}
run: mkdir package
- name: Setup Node
if: ${{ env.RELEASE_TAG != "" }}
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Load Cache
if: ${{ env.RELEASE_TAG != "" }}
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
backend/target
ui/node_modules
key: ${{ runner.os }}-package-${{ hashFiles('backend/Cargo.lock') }}-${{ hashFiles('ui/package-lock.json') }}
- name: Install UI Dependencies
if: ${{ env.RELEASE_TAG != "" }}
working-directory: ui
run: npm ci
- name: Build UI
if: ${{ env.RELEASE_TAG != "" }}
working-directory: ui
run: npm run build
- name: Copy Output
if: ${{ env.RELEASE_TAG != "" }}
run: cp -rv ui/.output package/ui
- name: Build Backend
if: ${{ env.RELEASE_TAG != "" }}
working-directory: backend
run: cargo build --release --locked
- name: Copy Binary
if: ${{ env.RELEASE_TAG != "" }}
run: cp -v backend/target/release/nuchat package/
- name: Package Output
if: ${{ env.RELEASE_TAG != "" }}
run: tar -cf - package | zstd -19 -T0 -o package.tar.zst
- name: Upload Package
if: ${{ env.RELEASE_TAG != "" }}
run: |-
curl -X PUT \
-H 'Authorization: token ${{ secrets.PACKAGE_API_KEY }}' \
--upload-file package.tar.zst \
"https://git.molloy.xyz/api/packages/fergus-molloy/generic/nuchat/${{ $RELEASE_TAG }}/nuchat.tar.zst"

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
.env .env
package/ package/
*.tar.zst package.tar.zst

16
package.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
mkdir package
pushd backend
cargo build --release
cp -v target/release/nuchat ../package/
popd
pushd ui
pnpm run build
cp -rv .output ../package/ui
popd
tar -cf - package/ | zstd -19 -T0 -o package.tar.zst

View File

@ -1,36 +0,0 @@
#!/usr/bin/env bash
function check_tags() {
TAGS="$(git tag --points-at HEAD)"
if [ -n "$TAGS" ]; then
TAG=$(echo "$TAGS" | grep -E '^v[0-9]+.[0-9]+.[0-9]+$' | sort -V | tail -1)
else
echo "No release tag found"
return 1
fi
}
function package() {
PACKAGE_DIR="${PACKAGE_DIR:-package}"
mkdir "$PACKAGE_DIR" > /dev/null 2>&1
pushd backend
cargo build --release
cp -v target/release/nuchat ../package/
popd
pushd ui
npm ci
npm run build
cp -rv .output ../package/ui
popd
OUT_FILE="${OUT_FILE:-package.tar.zst}"
if [ -f "$OUT_FILE" ]; then
rm "$OUT_FILE" > /dev/null 2>&1
fi
tar -cf - package/ | zstd -19 -T0 -o "${OUT_DIR}${OUT_FILE}"
}

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
. ./scripts/environ.sh
check_tags
if [ -n "$TAG" ]; then
echo "Found tag $TAG"
RELEASE_VERSION=$(echo "$TAG" | sed 's/v//')
echo "Releasing $RELEASE_VERSION"
echo ""
else
exit 1
fi
package
if [ ! -f package.tar.zst ]; then
echo "failed to generate package"
exit 1
fi
curl -s -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
--upload-file "$OUT_DIR$OUT_FILE" \
"https://git.molloy.xyz/api/packages/fergus-molloy/generic/nuchat/$RELEASE_VERSION/nuchat.tar.zst"

5
tags Normal file
View File

@ -0,0 +1,5 @@
v0.0.1
v0.0.2
test
v0.0.2_asdf