Compare commits
6 Commits
0.0.3
...
7ba9cd2c73
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ba9cd2c73 | |||
| bec8abfe47 | |||
| 7fcae49700 | |||
| b561c92f07 | |||
| 38cac0b257 | |||
| 5b08ca0dd2 |
55
.gitea/workflows/release.yaml
Normal file
55
.gitea/workflows/release.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
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
|
||||
steps:
|
||||
- run: echo ${{ github.ref }}
|
||||
- uses: actions/checkout@v4
|
||||
- name: Create Output Directory
|
||||
run: mkdir package
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '24'
|
||||
- name: Load Cache
|
||||
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
|
||||
working-directory: ui
|
||||
run: npm ci
|
||||
- name: Build UI
|
||||
working-directory: ui
|
||||
run: npm run build
|
||||
- name: Copy Output
|
||||
run: cp -rv ui/.output package/ui
|
||||
|
||||
|
||||
- name: Build Backend
|
||||
working-directory: backend
|
||||
run: cargo build --release --locked
|
||||
- name: Copy Binary
|
||||
run: cp -v backend/target/release/nuchat package/
|
||||
|
||||
- name: Package Output
|
||||
run: tar -cf - package | zstd -19 -T0 -o package.tar.zst
|
||||
|
||||
- name: Upload Package
|
||||
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/0.0.2/nuchat.tar.zst'
|
||||
|
||||
16
package.sh
Executable file
16
package.sh
Executable 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
|
||||
|
||||
@ -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}"
|
||||
}
|
||||
|
||||
@ -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"
|
||||
Reference in New Issue
Block a user