50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
|
|
env:
|
|
DL_DIR: /srv/breadway-dl
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: [self-hosted, hestia]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: build
|
|
run: cargo build --release --locked -p bakery
|
|
|
|
- name: test
|
|
run: cargo test --locked --workspace
|
|
|
|
- name: prepare artifacts
|
|
run: |
|
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
PKG_DIR="${DL_DIR}/bakery/${VERSION}"
|
|
mkdir -p "${PKG_DIR}"
|
|
|
|
cp target/release/bakery "${PKG_DIR}/bakery-x86_64"
|
|
strip "${PKG_DIR}/bakery-x86_64"
|
|
sha256sum "${PKG_DIR}/bakery-x86_64" | awk '{print $1}' \
|
|
> "${PKG_DIR}/bakery-x86_64.sha256"
|
|
|
|
cp bakery.toml "${PKG_DIR}/bakery.toml"
|
|
ln -sfn "${PKG_DIR}" "${DL_DIR}/bakery/latest"
|
|
|
|
- name: regenerate index.json
|
|
run: bash "${GITHUB_WORKSPACE}/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}/bakery/${VERSION}"
|
|
gh release create "${GITHUB_REF_NAME}" \
|
|
--title "bakery v${VERSION}" --generate-notes 2>/dev/null || true
|
|
gh release upload "${GITHUB_REF_NAME}" \
|
|
"${PKG_DIR}/bakery-x86_64" \
|
|
"${PKG_DIR}/bakery-x86_64.sha256" \
|
|
--clobber
|