mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 19:49:36 +00:00
- Bump version from 0.6.8 to 0.6.9 in Cargo.toml and Cargo.lock. - Enhance GitHub Actions workflow to build and publish .deb, .rpm, and Snap packages. - Implement AUR publishing for both dcr and dcr-bin packages. - Add support for workspace-only projects in the build system. - Introduce new `workspace` flag for build and run commands. - Create snapcraft.yaml for Snap package configuration. - Update build.rs and related files to handle workspace members and inheritance. - Modify config handling to support optional package and build configurations.
706 lines
24 KiB
YAML
706 lines
24 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Tag to build (e.g. v0.6.7)"
|
|
required: true
|
|
run_linux:
|
|
description: "Build Linux"
|
|
type: boolean
|
|
default: true
|
|
run_bsd:
|
|
description: "Build BSD"
|
|
type: boolean
|
|
default: true
|
|
run_macos:
|
|
description: "Build macOS"
|
|
type: boolean
|
|
default: true
|
|
run_windows:
|
|
description: "Build Windows"
|
|
type: boolean
|
|
default: true
|
|
run_publish:
|
|
description: "Publish to crates.io"
|
|
type: boolean
|
|
default: false
|
|
run_brew:
|
|
description: "Update Homebrew tap"
|
|
type: boolean
|
|
default: false
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
# ── Resolve Tag ────────────────────────────────────────────────────────────
|
|
setup:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tag: ${{ steps.tag.outputs.value }}
|
|
version: ${{ steps.tag.outputs.version }}
|
|
prerelease: ${{ steps.tag.outputs.prerelease }}
|
|
steps:
|
|
- name: Resolve tag
|
|
id: tag
|
|
run: |
|
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
TAG="${{ github.event.inputs.tag }}"
|
|
else
|
|
TAG="${GITHUB_REF_NAME}"
|
|
fi
|
|
VERSION="${TAG#v}"
|
|
[[ "$TAG" == *"-"* ]] && PRERELEASE="true" || PRERELEASE="false"
|
|
echo "value=${TAG}" >> "$GITHUB_OUTPUT"
|
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT"
|
|
|
|
# ── Release Notes ──────────────────────────────────────────────────────────
|
|
notes:
|
|
needs: setup
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
- name: Prepare Release Notes
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
tag="${{ needs.setup.outputs.version }}"
|
|
notes_file=".github/release-notes.md"
|
|
if grep -q "^## \\[${tag}\\]" CHANGELOG.md; then
|
|
awk -v ver="$tag" '
|
|
$0 ~ "^## \\[" ver "\\]" {found=1; next}
|
|
found && $0 ~ "^## \\[" {exit}
|
|
found {print}
|
|
' CHANGELOG.md | sed -e '${/^$/d;}' > "$notes_file"
|
|
else
|
|
echo "No CHANGELOG section for $tag." > "$notes_file"
|
|
git log -1 --pretty=format:"%s%n%n%b" >> "$notes_file"
|
|
fi
|
|
|
|
- name: Upload Notes Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-notes
|
|
path: .github/release-notes.md
|
|
|
|
# ── Linux ──────────────────────────────────────────────────────────────────
|
|
build-linux:
|
|
if: ${{ github.event_name == 'push' || github.event.inputs.run_linux == 'true' }}
|
|
needs: [setup, notes]
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- target: x86_64-unknown-linux-gnu
|
|
- target: aarch64-unknown-linux-gnu
|
|
- target: x86_64-unknown-linux-musl
|
|
- target: aarch64-unknown-linux-musl
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
- name: Download Release Notes
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: release-notes
|
|
path: .github
|
|
|
|
- name: Install cargo-zigbuild
|
|
run: |
|
|
pip install cargo-zigbuild
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Build
|
|
run: |
|
|
if [ "${{ matrix.target }}" != "x86_64-unknown-linux-gnu" ]; then
|
|
cargo zigbuild --release --target ${{ matrix.target }}
|
|
else
|
|
cargo build --release --target ${{ matrix.target }}
|
|
fi
|
|
|
|
- name: Prepare Artifact
|
|
run: |
|
|
ASSET="dcr-${{ matrix.target }}-${{ needs.setup.outputs.version }}"
|
|
cp target/${{ matrix.target }}/release/dcr "$ASSET"
|
|
echo "ASSET_NAME=${ASSET}" >> "$GITHUB_ENV"
|
|
|
|
- name: Upload Release Asset
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.setup.outputs.tag }}
|
|
files: ${{ env.ASSET_NAME }}
|
|
body_path: .github/release-notes.md
|
|
prerelease: ${{ needs.setup.outputs.prerelease == 'true' }}
|
|
|
|
# ── Linux Packages (.deb & .rpm) ───────────────────────────────────────────
|
|
build-deb-rpm:
|
|
if: ${{ github.event_name == 'push' || github.event.inputs.run_linux == 'true' }}
|
|
needs: [setup, notes]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
- name: Download Release Notes
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: release-notes
|
|
path: .github
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Install Tools
|
|
run: |
|
|
cargo install cargo-deb
|
|
cargo install cargo-generate-rpm
|
|
|
|
- name: Build Native Release
|
|
run: cargo build --release
|
|
|
|
- name: Generate .deb Package
|
|
run: cargo deb --no-build
|
|
|
|
- name: Generate .rpm Package
|
|
run: cargo generate-rpm
|
|
|
|
- name: Upload Packages to Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.setup.outputs.tag }}
|
|
files: |
|
|
target/debian/*.deb
|
|
target/generate-rpm/*.rpm
|
|
body_path: .github/release-notes.md
|
|
prerelease: ${{ needs.setup.outputs.prerelease == 'true' }}
|
|
|
|
# ── Snapcraft ──────────────────────────────────────────────────────────────
|
|
build-snap:
|
|
if: ${{ github.event_name == 'push' || github.event.inputs.run_linux == 'true' }}
|
|
needs: [setup, notes]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Build Release Binary
|
|
run: |
|
|
cargo build --release
|
|
# Создаем папки для контекста snapcraft, если внутри yaml завязан относительный путь
|
|
mkdir -p dist
|
|
cp target/release/dcr dist/
|
|
|
|
- name: Build Snap Package
|
|
uses: snapcore/action-build@v1
|
|
id: snapcraft
|
|
with:
|
|
path: packages/snap
|
|
|
|
- name: Upload Snap to Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.setup.outputs.tag }}
|
|
files: packages/snap/*.snap
|
|
prerelease: ${{ needs.setup.outputs.prerelease == 'true' }}
|
|
|
|
# ── macOS ──────────────────────────────────────────────────────────────────
|
|
build-macos:
|
|
if: ${{ github.event_name == 'push' || github.event.inputs.run_macos == 'true' }}
|
|
needs: [setup, notes]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: macos-15-intel
|
|
target: x86_64-apple-darwin
|
|
- os: macos-latest
|
|
target: aarch64-apple-darwin
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
- name: Download Release Notes
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: release-notes
|
|
path: .github
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Build
|
|
run: cargo build --release --target ${{ matrix.target }}
|
|
|
|
- name: Prepare Artifact
|
|
run: |
|
|
ASSET="dcr-${{ matrix.target }}-${{ needs.setup.outputs.version }}"
|
|
cp target/${{ matrix.target }}/release/dcr "$ASSET"
|
|
echo "ASSET_NAME=${ASSET}" >> "$GITHUB_ENV"
|
|
|
|
- name: Upload Release Asset
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.setup.outputs.tag }}
|
|
files: ${{ env.ASSET_NAME }}
|
|
body_path: .github/release-notes.md
|
|
prerelease: ${{ needs.setup.outputs.prerelease == 'true' }}
|
|
|
|
# ── BSD Systems ────────────────────────────────────────────────────────────
|
|
build-bsd:
|
|
if: ${{ github.event_name == 'push' || github.event.inputs.run_bsd == 'true' }}
|
|
needs: [setup, notes]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
- name: Download Release Notes
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: release-notes
|
|
path: .github
|
|
|
|
# ── FreeBSD ──
|
|
- name: Install cargo-zigbuild
|
|
run: |
|
|
pip install cargo-zigbuild
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Setup Rust (FreeBSD)
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-unknown-freebsd
|
|
|
|
- name: Build FreeBSD
|
|
run: cargo zigbuild --release --target x86_64-unknown-freebsd
|
|
|
|
- name: Prepare FreeBSD Artifact
|
|
run: |
|
|
ASSET="dcr-x86_64-unknown-freebsd-${{ needs.setup.outputs.version }}"
|
|
cp target/x86_64-unknown-freebsd/release/dcr "$ASSET"
|
|
echo "FREEBSD_ASSET=${ASSET}" >> "$GITHUB_ENV"
|
|
|
|
# ── OpenBSD ──
|
|
- name: Build in OpenBSD VM
|
|
uses: vmactions/openbsd-vm@v1
|
|
with:
|
|
usesh: true
|
|
run: |
|
|
pkg_add rust
|
|
cargo build --release
|
|
|
|
- name: Prepare OpenBSD Artifact
|
|
run: |
|
|
ASSET="dcr-x86_64-unknown-openbsd-${{ needs.setup.outputs.version }}"
|
|
cp target/release/dcr "$ASSET"
|
|
echo "OPENBSD_ASSET=${ASSET}" >> "$GITHUB_ENV"
|
|
|
|
# ── NetBSD ──
|
|
- name: Build in NetBSD VM
|
|
uses: vmactions/netbsd-vm@v1
|
|
with:
|
|
usesh: true
|
|
run: |
|
|
pkgin -y install rust
|
|
cargo build --release
|
|
|
|
- name: Prepare NetBSD Artifact
|
|
run: |
|
|
ASSET="dcr-x86_64-unknown-netbsd-${{ needs.setup.outputs.version }}"
|
|
cp target/release/dcr "$ASSET"
|
|
echo "NETBSD_ASSET=${ASSET}" >> "$GITHUB_ENV"
|
|
|
|
# ── Assets Upload ──
|
|
- name: Upload Release Assets
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.setup.outputs.tag }}
|
|
files: |
|
|
${{ env.FREEBSD_ASSET }}
|
|
${{ env.OPENBSD_ASSET }}
|
|
${{ env.NETBSD_ASSET }}
|
|
body_path: .github/release-notes.md
|
|
prerelease: ${{ needs.setup.outputs.prerelease == 'true' }}
|
|
|
|
# ── Windows ────────────────────────────────────────────────────────────────
|
|
build-windows:
|
|
if: ${{ github.event_name == 'push' || github.event.inputs.run_windows == 'true' }}
|
|
needs: [setup, notes]
|
|
runs-on: windows-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- target: x86_64-pc-windows-msvc
|
|
- target: aarch64-pc-windows-msvc
|
|
- target: x86_64-pc-windows-gnu
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
- name: Download Release Notes
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: release-notes
|
|
path: .github
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Build
|
|
run: cargo build --release --target ${{ matrix.target }}
|
|
|
|
- name: Prepare Artifact
|
|
shell: pwsh
|
|
run: |
|
|
$asset = "dcr-${{ matrix.target }}-${{ needs.setup.outputs.version }}.exe"
|
|
Copy-Item "target/${{ matrix.target }}/release/dcr.exe" "$asset"
|
|
"ASSET_NAME=$asset" >> $env:GITHUB_ENV
|
|
|
|
- name: Upload Release Asset
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.setup.outputs.tag }}
|
|
files: ${{ env.ASSET_NAME }}
|
|
body_path: .github/release-notes.md
|
|
prerelease: ${{ needs.setup.outputs.prerelease == 'true' }}
|
|
|
|
# ── Arch User Repository (dcr) ───────────────────────────────────
|
|
publish-aur:
|
|
if: "!contains(github.ref_name, '-')"
|
|
needs: [setup]
|
|
runs-on: ubuntu-latest
|
|
environment: aur
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Derive checksum
|
|
id: meta
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
SRC_URL="https://github.com/dexoron/dcr/archive/refs/tags/${{ needs.setup.outputs.tag }}.tar.gz"
|
|
SHA256="$(curl -fsSL "$SRC_URL" | sha256sum | awk '{print $1}')"
|
|
echo "source_url=$SRC_URL" >> "$GITHUB_OUTPUT"
|
|
echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Render AUR metadata
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
PKGVER='${{ needs.setup.outputs.version }}'
|
|
SRC_URL='${{ steps.meta.outputs.source_url }}'
|
|
SHA256='${{ steps.meta.outputs.sha256 }}'
|
|
|
|
mkdir -p packages/aur/dcr
|
|
cat > packages/aur/dcr/PKGBUILD <<PKG
|
|
pkgname=dcr
|
|
pkgver=${PKGVER}
|
|
pkgrel=1
|
|
pkgdesc="Cargo-like utility to manage C/C++ projects"
|
|
arch=('x86_64' 'aarch64')
|
|
url="https://github.com/dexoron/dcr"
|
|
license=('GPL-3.0-or-later')
|
|
depends=('gcc-libs')
|
|
makedepends=('cargo')
|
|
options=('!lto')
|
|
optdepends=(
|
|
'gcc: build C/C++ projects with GCC'
|
|
'clang: build C/C++ projects with Clang'
|
|
)
|
|
source=("\$pkgname-\$pkgver.tar.gz::\$url/archive/refs/tags/v\$pkgver.tar.gz")
|
|
sha256sums=('${SHA256}')
|
|
|
|
build() {
|
|
cd "\$srcdir/\$pkgname-\$pkgver"
|
|
export CARGO_PROFILE_RELEASE_LTO=false
|
|
export RUSTFLAGS="\${RUSTFLAGS:-}"
|
|
export RUSTFLAGS="\${RUSTFLAGS/-C link-arg=-fuse-ld=lld/}"
|
|
cargo build --release --locked
|
|
}
|
|
|
|
package() {
|
|
cd "\$srcdir/\$pkgname-\$pkgver"
|
|
install -Dm755 "target/release/dcr" "\$pkgdir/usr/bin/dcr"
|
|
install -Dm644 LICENSE "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE"
|
|
}
|
|
PKG
|
|
|
|
cat > packages/aur/dcr/.SRCINFO <<SRC
|
|
pkgbase = dcr
|
|
pkgdesc = Cargo-like utility to manage C/C++ projects
|
|
pkgver = ${PKGVER}
|
|
pkgrel = 1
|
|
url = https://github.com/dexoron/dcr
|
|
arch = x86_64
|
|
arch = aarch64
|
|
license = GPL-3.0-or-later
|
|
makedepends = cargo
|
|
depends = gcc-libs
|
|
optdepends = gcc: build C/C++ projects with GCC
|
|
optdepends = clang: build C/C++ projects with Clang
|
|
options = !lto
|
|
source = dcr-${PKGVER}.tar.gz::${SRC_URL}
|
|
sha256sums = ${SHA256}
|
|
|
|
pkgname = dcr
|
|
SRC
|
|
|
|
- name: Push to AUR
|
|
env:
|
|
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
|
AUR_PACKAGE: dcr
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
install -d -m 700 ~/.ssh
|
|
printf '%s\n' "$AUR_SSH_PRIVATE_KEY" > ~/.ssh/aur
|
|
chmod 600 ~/.ssh/aur
|
|
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
|
|
|
export GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes'
|
|
git clone "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git" aur-repo
|
|
cp packages/aur/dcr/PKGBUILD aur-repo/PKGBUILD
|
|
cp packages/aur/dcr/.SRCINFO aur-repo/.SRCINFO
|
|
|
|
cd aur-repo
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
if git diff --quiet; then
|
|
echo "No AUR changes"
|
|
exit 0
|
|
fi
|
|
|
|
git add PKGBUILD .SRCINFO
|
|
git commit -m "dcr ${{ needs.setup.outputs.version }}"
|
|
git push
|
|
|
|
# ── Arch User Repository (dcr-bin) ────────────────────────────────
|
|
publish-aur-bin:
|
|
if: "!contains(github.ref_name, '-')"
|
|
# Ждем сборку линукса, чтобы бинарник гарантированно лежал в релизах
|
|
needs: [setup, build-linux]
|
|
runs-on: ubuntu-latest
|
|
environment: aur
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Derive checksum
|
|
id: meta
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
BIN_URL="https://github.com/dexoron/dcr/releases/download/${{ needs.setup.outputs.tag }}/dcr-x86_64-unknown-linux-musl-${{ needs.setup.outputs.version }}"
|
|
SHA256="$(curl -fsSL "$BIN_URL" | sha256sum | awk '{print $1}')"
|
|
echo "bin_url=$BIN_URL" >> "$GITHUB_OUTPUT"
|
|
echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Render AUR Metadata
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
PKGVER='${{ needs.setup.outputs.version }}'
|
|
BIN_URL='${{ steps.meta.outputs.bin_url }}'
|
|
SHA256='${{ steps.meta.outputs.sha256 }}'
|
|
|
|
mkdir -p packages/aur/dcr-bin
|
|
cat > packages/aur/dcr-bin/PKGBUILD <<PKG
|
|
pkgname=dcr-bin
|
|
pkgver=${PKGVER}
|
|
pkgrel=1
|
|
pkgdesc="Cargo-like utility to manage C/C++ projects (pre-compiled musl binary)"
|
|
arch=('x86_64')
|
|
url="https://github.com/dexoron/dcr"
|
|
license=('GPL-3.0-or-later')
|
|
provides=('dcr')
|
|
conflicts=('dcr')
|
|
optdepends=(
|
|
'gcc: build C/C++ projects with GCC'
|
|
'clang: build C/C++ projects with Clang'
|
|
)
|
|
source_x86_64=("dcr-\$pkgver::${BIN_URL}")
|
|
sha256sums_x86_64=('${SHA256}')
|
|
|
|
package() {
|
|
install -Dm755 "\$srcdir/dcr-\$pkgver" "\$pkgdir/usr/bin/dcr"
|
|
}
|
|
PKG
|
|
|
|
cat > packages/aur/dcr-bin/.SRCINFO <<SRC
|
|
pkgbase = dcr-bin
|
|
pkgdesc = Cargo-like utility to manage C/C++ projects (pre-compiled musl binary)
|
|
pkgver = ${PKGVER}
|
|
pkgrel = 1
|
|
url = https://github.com/dexoron/dcr
|
|
arch = x86_64
|
|
license = GPL-3.0-or-later
|
|
provides = dcr
|
|
conflicts = dcr
|
|
optdepends = gcc: build C/C++ projects with GCC
|
|
optdepends = clang: build C/C++ projects with Clang
|
|
source_x86_64 = dcr-${PKGVER}::${BIN_URL}
|
|
sha256sums_x86_64 = ${SHA256}
|
|
|
|
pkgname = dcr-bin
|
|
SRC
|
|
|
|
- name: Push to AUR
|
|
env:
|
|
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
|
AUR_PACKAGE: dcr-bin
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
install -d -m 700 ~/.ssh
|
|
printf '%s\n' "$AUR_SSH_PRIVATE_KEY" > ~/.ssh/aur
|
|
chmod 600 ~/.ssh/aur
|
|
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
|
|
|
export GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes'
|
|
git clone "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git" aur-repo
|
|
cp packages/aur/dcr-bin/PKGBUILD aur-repo/PKGBUILD
|
|
cp packages/aur/dcr-bin/.SRCINFO aur-repo/.SRCINFO
|
|
|
|
cd aur-repo
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
if git diff --quiet; then
|
|
echo "No AUR changes"
|
|
exit 0
|
|
fi
|
|
|
|
git add PKGBUILD .SRCINFO
|
|
git commit -m "dcr-bin ${{ needs.setup.outputs.version }}"
|
|
git push
|
|
|
|
# ── crates.io ──────────────────────────────────────────────────────────────
|
|
publish-crates:
|
|
if: |
|
|
(github.event_name == 'push' && needs.setup.outputs.prerelease == 'false') ||
|
|
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_publish == 'true')
|
|
needs: [setup, build-linux, build-macos, build-windows, build-bsd]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Publish to crates.io
|
|
run: cargo publish
|
|
|
|
# ── Homebrew tap ───────────────────────────────────────────────────────────
|
|
publish-brew:
|
|
if: |
|
|
(github.event_name == 'push' && needs.setup.outputs.prerelease == 'false') ||
|
|
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_brew == 'true')
|
|
needs: [setup, build-linux, build-macos]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download release assets and compute sha256
|
|
id: sha
|
|
run: |
|
|
VERSION="${{ needs.setup.outputs.version }}"
|
|
BASE="https://github.com/dexoron/dcr/releases/download/v${VERSION}"
|
|
|
|
download_sha() {
|
|
curl -fsSL "${BASE}/$1" | sha256sum | awk '{print $1}'
|
|
}
|
|
|
|
echo "linux_x86=$(download_sha "dcr-x86_64-unknown-linux-gnu-${VERSION}")" >> "$GITHUB_OUTPUT"
|
|
echo "linux_arm=$(download_sha "dcr-aarch64-unknown-linux-gnu-${VERSION}")" >> "$GITHUB_OUTPUT"
|
|
echo "macos_x86=$(download_sha "dcr-x86_64-apple-darwin-${VERSION}")" >> "$GITHUB_OUTPUT"
|
|
echo "macos_arm=$(download_sha "dcr-aarch64-apple-darwin-${VERSION}")" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Checkout homebrew-dexoron
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: dexoron/homebrew-dexoron
|
|
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
|
|
|
- name: Update Formula/dcr.rb
|
|
run: |
|
|
VERSION="${{ needs.setup.outputs.version }}"
|
|
cat > Formula/dcr.rb <<FORMULA
|
|
class Dcr < Formula
|
|
desc "Cargo-like utility to manage C/C++ projects"
|
|
homepage "https://dcr.dexoron.su"
|
|
version "${VERSION}"
|
|
|
|
on_macos do
|
|
on_intel do
|
|
url "https://github.com/dexoron/dcr/releases/download/v#{version}/dcr-x86_64-apple-darwin-#{version}"
|
|
sha256 "${{ steps.sha.outputs.macos_x86 }}"
|
|
end
|
|
on_arm do
|
|
url "https://github.com/dexoron/dcr/releases/download/v#{version}/dcr-aarch64-apple-darwin-#{version}"
|
|
sha256 "${{ steps.sha.outputs.macos_arm }}"
|
|
end
|
|
end
|
|
|
|
on_linux do
|
|
on_intel do
|
|
url "https://github.com/dexoron/dcr/releases/download/v#{version}/dcr-x86_64-unknown-linux-gnu-#{version}"
|
|
sha256 "${{ steps.sha.outputs.linux_x86 }}"
|
|
end
|
|
on_arm do
|
|
url "https://github.com/dexoron/dcr/releases/download/v#{version}/dcr-aarch64-unknown-linux-gnu-#{version}"
|
|
sha256 "${{ steps.sha.outputs.linux_arm }}"
|
|
end
|
|
end
|
|
|
|
def install
|
|
bin.install Dir["dcr*"].first => "dcr"
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/dcr", "--version"
|
|
end
|
|
end
|
|
FORMULA
|
|
|
|
- name: Commit and push
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add Formula/dcr.rb
|
|
git diff --staged --quiet && echo "No changes" && exit 0
|
|
git commit -m "dcr ${{ needs.setup.outputs.version }}"
|
|
git push |