check for tag before releasing
This commit is contained in:
@ -6,28 +6,24 @@ on: [push]
|
||||
# - 'v[0-9]+\.[0-9]+\.[0-9]+'
|
||||
|
||||
jobs:
|
||||
check-tag:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check for Tag
|
||||
run: |-
|
||||
TAGS="$(git tag --points-at HEAD)"
|
||||
if [ -n $TAGS ]; then
|
||||
fi
|
||||
|
||||
package:
|
||||
runs-on: rust-latest
|
||||
depends-on: ["check-tag"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check for Tag
|
||||
run: ./check-for-tag.sh
|
||||
|
||||
- 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: |
|
||||
@ -38,28 +34,35 @@ jobs:
|
||||
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/0.0.2/nuchat.tar.zst'
|
||||
"https://git.molloy.xyz/api/packages/fergus-molloy/generic/nuchat/${{ $RELEASE_TAG }}/nuchat.tar.zst"
|
||||
|
||||
|
||||
9
check-for-tag.sh
Executable file
9
check-for-tag.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user