feat(daemon): add serial console reader and UI tab for serial logs; add version propagation and CI/release workflows
This commit is contained in:
108
.gitea/workflows/release.yml
Normal file
108
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,108 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
|
||||
jobs:
|
||||
release:
|
||||
if: github.ref_type == 'tag'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Deno
|
||||
uses: denoland/setup-deno@v1
|
||||
with:
|
||||
deno-version: v2.x
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
|
||||
- name: Get version from tag
|
||||
id: version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set version in package.json and version.ts
|
||||
run: |
|
||||
npm version ${{ steps.version.outputs.version_number }} --no-git-tag-version --allow-same-version
|
||||
echo "export const VERSION = \"${{ steps.version.outputs.version_number }}\";" > ecoos_daemon/ts/version.ts
|
||||
|
||||
- name: Build daemon binary
|
||||
run: pnpm run daemon:bundle
|
||||
|
||||
- name: Build ISO with Docker
|
||||
run: |
|
||||
cp ecoos_daemon/bundle/eco-daemon isobuild/config/includes.chroot/opt/eco/bin/
|
||||
mkdir -p .nogit/iso
|
||||
docker build -t ecoos-builder -f isobuild/Dockerfile .
|
||||
docker run --rm --privileged -v $(pwd)/.nogit/iso:/output ecoos-builder
|
||||
|
||||
- name: Prepare release assets
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
mkdir -p dist
|
||||
cp .nogit/iso/ecoos.iso "dist/ecoos-${VERSION}.iso"
|
||||
cp ecoos_daemon/bundle/eco-daemon "dist/eco-daemon-${VERSION}"
|
||||
cd dist && sha256sum * > SHA256SUMS.txt
|
||||
ls -lh
|
||||
|
||||
- name: Delete existing release if exists
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
EXISTING=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://code.foss.global/api/v1/repos/${{ gitea.repository }}/releases/tags/$VERSION" | jq -r '.id // empty')
|
||||
if [ -n "$EXISTING" ]; then
|
||||
echo "Deleting existing release $EXISTING"
|
||||
curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://code.foss.global/api/v1/repos/${{ gitea.repository }}/releases/$EXISTING"
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
- name: Create Release and upload assets
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
|
||||
# Create release
|
||||
RELEASE_ID=$(curl -X POST -s \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"https://code.foss.global/api/v1/repos/${{ gitea.repository }}/releases" \
|
||||
-d "{
|
||||
\"tag_name\": \"$VERSION\",
|
||||
\"name\": \"EcoOS $VERSION\",
|
||||
\"body\": \"## EcoOS $VERSION\n\n### Assets\n- **ecoos-${VERSION}.iso** - Full bootable ISO image\n- **eco-daemon-${VERSION}** - Daemon binary for in-place upgrades\n\n### Checksums\nSHA256 checksums in SHA256SUMS.txt\",
|
||||
\"draft\": false,
|
||||
\"prerelease\": false
|
||||
}" | jq -r '.id')
|
||||
|
||||
echo "Created release with ID: $RELEASE_ID"
|
||||
|
||||
# Upload assets
|
||||
for asset in dist/*; do
|
||||
filename=$(basename "$asset")
|
||||
echo "Uploading $filename..."
|
||||
curl -X POST -s \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$asset" \
|
||||
"https://code.foss.global/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets?name=$filename"
|
||||
done
|
||||
|
||||
- name: Cleanup old releases (keep 3 latest)
|
||||
run: |
|
||||
echo "Checking for old releases to clean up..."
|
||||
RELEASES=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://code.foss.global/api/v1/repos/${{ gitea.repository }}/releases" | \
|
||||
jq -r 'sort_by(.created_at) | reverse | .[3:] | .[].id')
|
||||
|
||||
for id in $RELEASES; do
|
||||
echo "Deleting old release $id"
|
||||
curl -X DELETE -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://code.foss.global/api/v1/repos/${{ gitea.repository }}/releases/$id"
|
||||
done
|
||||
echo "Cleanup complete"
|
||||
Reference in New Issue
Block a user