CI: add release workflow
Some checks failed
release / build (push) Failing after 2s

This commit is contained in:
Breadway 2026-07-02 21:03:19 +08:00
parent 854c5752f9
commit 62a45025ae

54
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,54 @@
name: release
on:
push:
tags: ["v*"]
permissions:
contents: write
env:
DL_DIR: /srv/breadway-dl
ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci
jobs:
build:
runs-on: [self-hosted, hestia]
steps:
- uses: actions/checkout@v4
- name: build
run: cargo build --release --locked
- name: prepare artifacts
run: |
VERSION="${GITHUB_REF_NAME#v}"
PKG_DIR="${DL_DIR}/breadshot/${VERSION}"
mkdir -p "${PKG_DIR}"
cp "target/release/breadshot" "${PKG_DIR}/breadshot-x86_64"
strip "${PKG_DIR}/breadshot-x86_64"
sha256sum "${PKG_DIR}/breadshot-x86_64" | awk '{print $1}' \
> "${PKG_DIR}/breadshot-x86_64.sha256"
cp bakery.toml "${PKG_DIR}/bakery.toml"
ln -sfn "${VERSION}" "${DL_DIR}/breadshot/latest"
- name: ensure bread-ecosystem
run: |
rm -rf "${ECOSYSTEM_DIR}"
git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}"
- 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}/breadshot/${VERSION}"
gh release create "${GITHUB_REF_NAME}" \
--title "breadshot v${VERSION}" --generate-notes 2>/dev/null || true
gh release upload "${GITHUB_REF_NAME}" \
"${PKG_DIR}/breadshot-x86_64" \
"${PKG_DIR}/breadshot-x86_64.sha256" \
--clobber