文件
ParlzPackageManger/.github/workflows/release.yml
T
工作流配置文件无效。请检查您的配置文件:model.ReadWorkflow: yaml: line 78: could not find expected ':'

98 行
3.0 KiB
YAML

name: build
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: windows-amd64
cc: x86_64-w64-mingw32-gcc
ext: .exe
pkg: mingw-w64
- target: linux-amd64
cc: gcc
ext: ''
pkg: ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
if: ${{ matrix.pkg != '' }}
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.pkg }}
- name: Build pmm
run: |
mkdir -p out
VER=${{ github.ref_type == 'tag' && github.ref_name || 'dev' }}
VER=${VER#v}
${{ matrix.cc }} -O2 -Wall -static -std=c11 -D_FORTIFY_SOURCE=0 -U_FORTIFY_SOURCE -DPMM_VERSION=\"$VER\" -o out/pmm${{ matrix.ext }} \
src/main.c src/json.c src/ini.c src/pmm.c src/http.c src/repo.c src/install.c \
src/sha256.c src/sha1.c src/mirrors.c src/pdm.c
- name: Package installers
run: |
sudo apt-get update >/dev/null 2>&1
sudo apt-get install -y zip dpkg-dev xxd >/dev/null 2>&1 || true
VER=${{ github.ref_type == 'tag' && github.ref_name || 'dev' }}
VER=${VER#v}
# -- install.sh helper (uploaded to the release, also served at /install.sh)
cp web/install.sh out/install.sh
# -- Windows: ZIP (the EXE setup wizard is a separate .NET build,
# see win/installer/ — needs a Windows runner so it's built there)
if [ -f out/pmm.exe ]; then
( cd out && zip -q "pmm-${VER}-windows-amd64.zip" pmm.exe )
cp web/downloads/pmm-${VER}-windows-amd64.zip out/ 2>/dev/null || true
fi
# -- Linux: .deb
if [ -f out/pmm ]; then
rm -rf pkg && mkdir -p pkg/DEBIAN pkg/usr/local/bin
cp out/pmm pkg/usr/local/bin/pmm
cat > pkg/DEBIAN/control <<EOF
Package: pmm
Version: $VER
Section: devel
Priority: optional
Architecture: amd64
Maintainer: PMM <packages@pmm.dev>
Installed-Size: $(du -k pkg/usr/local/bin/pmm | cut -f1)
Description: ParlzPackageManager (PMM) - cross-platform C package manager
A cross-platform (Windows/Linux/macOS) package manager written in C, with
apt-style multi-mirror (mirror.ini), git release installs, .pdm packages
and SHA-256/SHA-1 verification.
EOF
( cd pkg/usr/local/bin && md5sum pmm > ../DEBIAN/md5sums )
dpkg-deb --build --root-owner-group pkg "out/pmm_${VER}_amd64.deb"
rm -rf pkg
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: out/*
if-no-files-found: error
- name: Release (tagged)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: out/*
generate_release_notes: true
name: PMM ${{ github.ref_name }}