CI: migrate release workflow from GitHub Actions to Forgejo Actions
GitHub Actions self-hosted runners need per-repo registration on a personal account; Forgejo Actions' runner already serves every repo with zero setup. Moves release publishing there (dl.breadway.dev stays the primary bakery target; GitHub release upload is kept as the fallback via an explicit token, since Forgejo Actions has no ambient GITHUB_TOKEN) and adds a mirror workflow to keep GitHub in sync automatically.
This commit is contained in:
parent
680c1f0cec
commit
1fda781b4c
4 changed files with 70 additions and 74 deletions
|
|
@ -14,8 +14,6 @@ jobs:
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git
|
git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git
|
||||||
cd repo.git
|
cd repo.git
|
||||||
# Mirror only branches and tags (not refs/pull/*, which GitHub rejects);
|
|
||||||
# --prune deletes GitHub refs that no longer exist on Forgejo.
|
|
||||||
git push --prune \
|
git push --prune \
|
||||||
"https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/bread.git" \
|
"https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/bread.git" \
|
||||||
'+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*'
|
'+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*'
|
||||||
|
|
|
||||||
61
.forgejo/workflows/release.yml
Normal file
61
.forgejo/workflows/release.yml
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["v*"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: [self-hosted, hestia]
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
rm -rf src && mkdir src
|
||||||
|
git clone --branch "${GITHUB_REF_NAME}" --depth 1 \
|
||||||
|
"https://git.breadway.dev/${GITHUB_REPOSITORY}.git" src
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: cd src && cargo build --release --locked
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: cd src && cargo test --release --locked --workspace
|
||||||
|
|
||||||
|
- name: prepare artifacts
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
VERSION="${GITHUB_REF_NAME#v}"
|
||||||
|
PKG_DIR="/srv/breadway-dl/bread/${VERSION}"
|
||||||
|
mkdir -p "${PKG_DIR}"
|
||||||
|
for bin in breadd bread; do
|
||||||
|
cp "src/target/release/${bin}" "${PKG_DIR}/${bin}-x86_64"
|
||||||
|
strip "${PKG_DIR}/${bin}-x86_64"
|
||||||
|
sha256sum "${PKG_DIR}/${bin}-x86_64" | awk '{print $1}' \
|
||||||
|
> "${PKG_DIR}/${bin}-x86_64.sha256"
|
||||||
|
done
|
||||||
|
cp src/packaging/systemd/breadd.service "${PKG_DIR}/"
|
||||||
|
cp src/bakery.toml "${PKG_DIR}/bakery.toml"
|
||||||
|
ln -sfn "${VERSION}" "/srv/breadway-dl/bread/latest"
|
||||||
|
|
||||||
|
- name: regenerate index.json
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
rm -rf /tmp/bread-ecosystem-ci
|
||||||
|
git clone https://git.breadway.dev/Breadway/bread-ecosystem.git /tmp/bread-ecosystem-ci
|
||||||
|
bash /tmp/bread-ecosystem-ci/scripts/gen-index.sh
|
||||||
|
|
||||||
|
- name: upload to GitHub Release
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
VERSION="${GITHUB_REF_NAME#v}"
|
||||||
|
PKG_DIR="/srv/breadway-dl/bread/${VERSION}"
|
||||||
|
gh release create "${GITHUB_REF_NAME}" --repo Breadway/bread \
|
||||||
|
--title "bread v${VERSION}" --generate-notes 2>/dev/null || true
|
||||||
|
gh release upload "${GITHUB_REF_NAME}" --repo Breadway/bread \
|
||||||
|
"${PKG_DIR}/breadd-x86_64" \
|
||||||
|
"${PKG_DIR}/bread-x86_64" \
|
||||||
|
"${PKG_DIR}/breadd-x86_64.sha256" \
|
||||||
|
"${PKG_DIR}/bread-x86_64.sha256" \
|
||||||
|
--clobber
|
||||||
69
.github/workflows/release.yml
vendored
69
.github/workflows/release.yml
vendored
|
|
@ -1,69 +0,0 @@
|
||||||
name: release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: ["v*"]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
DL_DIR: /srv/breadway-dl
|
|
||||||
ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: [self-hosted, hestia]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: install build deps
|
|
||||||
run: sudo apt-get install -y libudev-dev libdbus-1-dev pkg-config 2>/dev/null || true
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
run: cargo build --release --locked
|
|
||||||
|
|
||||||
- name: test
|
|
||||||
run: cargo test --release --locked --workspace
|
|
||||||
|
|
||||||
- name: prepare artifacts
|
|
||||||
run: |
|
|
||||||
VERSION="${GITHUB_REF_NAME#v}"
|
|
||||||
PKG_DIR="${DL_DIR}/bread/${VERSION}"
|
|
||||||
mkdir -p "${PKG_DIR}"
|
|
||||||
for bin in breadd bread; do
|
|
||||||
cp "target/release/${bin}" "${PKG_DIR}/${bin}-x86_64"
|
|
||||||
strip "${PKG_DIR}/${bin}-x86_64"
|
|
||||||
sha256sum "${PKG_DIR}/${bin}-x86_64" | awk '{print $1}' \
|
|
||||||
> "${PKG_DIR}/${bin}-x86_64.sha256"
|
|
||||||
done
|
|
||||||
cp packaging/systemd/breadd.service "${PKG_DIR}/"
|
|
||||||
cp bakery.toml "${PKG_DIR}/bakery.toml"
|
|
||||||
ln -sfn "${VERSION}" "${DL_DIR}/bread/latest"
|
|
||||||
|
|
||||||
- name: ensure bread-ecosystem
|
|
||||||
run: |
|
|
||||||
if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then
|
|
||||||
git -C "${ECOSYSTEM_DIR}" pull --ff-only
|
|
||||||
else
|
|
||||||
mkdir -p "$(dirname "${ECOSYSTEM_DIR}")"
|
|
||||||
git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: regenerate index.json
|
|
||||||
run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh"
|
|
||||||
|
|
||||||
- name: upload to GitHub Release
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
VERSION="${GITHUB_REF_NAME#v}"
|
|
||||||
PKG_DIR="${DL_DIR}/bread/${VERSION}"
|
|
||||||
gh release create "${GITHUB_REF_NAME}" \
|
|
||||||
--title "bread v${VERSION}" --generate-notes 2>/dev/null || true
|
|
||||||
gh release upload "${GITHUB_REF_NAME}" \
|
|
||||||
"${PKG_DIR}/breadd-x86_64" \
|
|
||||||
"${PKG_DIR}/bread-x86_64" \
|
|
||||||
"${PKG_DIR}/breadd-x86_64.sha256" \
|
|
||||||
"${PKG_DIR}/bread-x86_64.sha256" \
|
|
||||||
--clobber
|
|
||||||
12
README.md
12
README.md
|
|
@ -175,6 +175,7 @@ All commands communicate with the running daemon over a Unix socket at `$XDG_RUN
|
||||||
bread ping # Check daemon connectivity
|
bread ping # Check daemon connectivity
|
||||||
bread health # Daemon version, uptime, PID
|
bread health # Daemon version, uptime, PID
|
||||||
bread doctor # Diagnose daemon and module health
|
bread doctor # Diagnose daemon and module health
|
||||||
|
bread doctor --json # Output raw JSON
|
||||||
|
|
||||||
# Lua runtime
|
# Lua runtime
|
||||||
bread reload # Hot-reload all Lua modules
|
bread reload # Hot-reload all Lua modules
|
||||||
|
|
@ -182,9 +183,13 @@ bread reload --watch # Watch config dir and reload on changes
|
||||||
|
|
||||||
# State and events
|
# State and events
|
||||||
bread state # Dump full runtime state as JSON
|
bread state # Dump full runtime state as JSON
|
||||||
|
bread state network # Read a single path from state
|
||||||
|
bread state --json # Output raw JSON
|
||||||
bread events # Stream live normalized events
|
bread events # Stream live normalized events
|
||||||
bread events bread.device.* # Stream filtered events
|
bread events bread.device.* # Stream filtered events
|
||||||
bread events --since 60 # Replay events from the last 60 seconds
|
bread events --since 60 # Replay events from the last 60 seconds
|
||||||
|
bread events --fields event,data # Limit output to specific fields
|
||||||
|
bread events --json # Output raw JSON
|
||||||
bread emit <event> # Manually fire an event (for testing)
|
bread emit <event> # Manually fire an event (for testing)
|
||||||
|
|
||||||
# Profiles
|
# Profiles
|
||||||
|
|
@ -194,7 +199,7 @@ bread profile-activate <name> # Activate a named profile
|
||||||
# Modules
|
# Modules
|
||||||
bread modules list # List installed modules and daemon status
|
bread modules list # List installed modules and daemon status
|
||||||
bread modules install /local/path # Install from a local module directory
|
bread modules install /local/path # Install from a local module directory
|
||||||
bread modules remove <name> # Remove an installed module
|
bread modules remove <name> # Remove an installed module (--yes skips confirmation)
|
||||||
bread modules info <name> # Show full manifest and daemon status
|
bread modules info <name> # Show full manifest and daemon status
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -377,8 +382,9 @@ bread.profile.activate("default")
|
||||||
bread.exec("kitty")
|
bread.exec("kitty")
|
||||||
|
|
||||||
-- Desktop notification (uses notify-send)
|
-- Desktop notification (uses notify-send)
|
||||||
bread.notify("Title", { urgency = "normal", timeout = 3000, icon = "dialog-info" })
|
-- First arg is the message body; opts.title sets the notification title (default: "bread")
|
||||||
bread.notify("Simple message") -- title defaults to "bread"
|
bread.notify("Something happened", { title = "My Module", urgency = "normal", timeout = 3000, icon = "dialog-info" })
|
||||||
|
bread.notify("AC connected") -- title defaults to "bread"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Timers
|
### Timers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue