mirror of
https://github.com/Vale54321/schafkop-neu.git
synced 2025-12-13 10:39:33 +01:00
delete back and frontend
add schafkopf os add build firmware action
This commit is contained in:
66
.github/workflows/BuildAndPushContainer.yml
vendored
66
.github/workflows/BuildAndPushContainer.yml
vendored
@@ -1,66 +0,0 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}/app
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: [self-hosted]
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=sha,format=short
|
||||
type=ref,event=branch
|
||||
|
||||
- name: Build and push Docker image (multi-arch)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
NODE_VERSION=20-bookworm-slim
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify updater (GET, bearer)
|
||||
if: ${{ success() && github.ref == 'refs/heads/main' }}
|
||||
env:
|
||||
WEBHOOK_TOKEN: ${{ secrets.WEBHOOK_TOKEN }}
|
||||
run: |
|
||||
curl -fsS --retry 5 -H "Authorization: Bearer ${WEBHOOK_TOKEN}" http://10.0.3.185:8080/v1/update
|
||||
100
.github/workflows/build-firmware.yml
vendored
Normal file
100
.github/workflows/build-firmware.yml
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
name: Build Firmware
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
BRANCH_RAW: ${{ github.ref_name }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./pico
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
~/.platformio/.cache
|
||||
key: ${{ runner.os }}-pio
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: pip install --upgrade platformio
|
||||
|
||||
- name: Build PlatformIO Project
|
||||
run: pio run
|
||||
|
||||
- name: Compute branch slug & tag
|
||||
id: meta
|
||||
run: |
|
||||
set -euo pipefail
|
||||
slug="$BRANCH_RAW"
|
||||
# Replace anything not [A-Za-z0-9._-] with '-'
|
||||
slug="${slug//[^A-Za-z0-9._-]/-}"
|
||||
# Trim to 60 chars (tags can be long, but keep it tidy)
|
||||
slug="${slug:0:60}"
|
||||
# Avoid trailing dots or dashes
|
||||
slug="${slug%-}"
|
||||
slug="${slug%.}"
|
||||
echo "slug=$slug" >> "$GITHUB_OUTPUT"
|
||||
echo "tag=nightly-$slug" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Ensure rolling prerelease exists (create if missing)
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TAG="${{ steps.meta.outputs.tag }}"
|
||||
if gh release view "$TAG" >/dev/null 2>&1; then
|
||||
echo "Release $TAG exists — make sure tag points to this commit"
|
||||
git config user.email "actions@github.com"
|
||||
git config user.name "GitHub Actions"
|
||||
git fetch --tags --force
|
||||
git tag -f "$TAG" "$GITHUB_SHA"
|
||||
git push --force origin "refs/tags/$TAG"
|
||||
# Make sure it remains a prerelease
|
||||
gh release edit "$TAG" --prerelease --title "Nightly ($BRANCH_RAW)"
|
||||
else
|
||||
gh release create "$TAG" \
|
||||
--title "Nightly ($BRANCH_RAW)" \
|
||||
--notes "Latest successful build of branch: $BRANCH_RAW" \
|
||||
--prerelease
|
||||
fi
|
||||
|
||||
- name: Attach/overwrite assets
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TAG="${{ steps.meta.outputs.tag }}"
|
||||
|
||||
# Optional: write a tiny manifest for fast comparisons on the device
|
||||
mkdir -p .nightly
|
||||
cat > .nightly/manifest.json <<EOF
|
||||
{
|
||||
"branch": "${BRANCH_RAW}",
|
||||
"tag": "${TAG}",
|
||||
"commit": "${GITHUB_SHA}",
|
||||
"built_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
}
|
||||
EOF
|
||||
|
||||
# Upload and overwrite ( --clobber ) to keep filenames stable
|
||||
gh release upload "$TAG" \
|
||||
.pio/build/pico/firmware.uf2 \
|
||||
.nightly/manifest.json \
|
||||
--clobber
|
||||
Reference in New Issue
Block a user