Skip to content

ci: 添加 nfpm 安装以支持 .deb/.rpm 打包 #3

ci: 添加 nfpm 安装以支持 .deb/.rpm 打包

ci: 添加 nfpm 安装以支持 .deb/.rpm 打包 #3

Workflow file for this run

name: Build & Release
on:
push:
branches:
- master
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- 'VERSION'
- 'bin/**'
- '.github/workflows/build-release.yml'
workflow_dispatch:
permissions:
contents: write
jobs:
# ── Linux: amd64/386/arm/arm64/mips/mipsle + BSDs + Solaris + Plan9 + AIX ──
build-linux:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version: '~1.26.3'
check-latest: true
- name: Install libraries
run: |
sudo apt-get update
sudo apt-get install -y fuse3 libfuse-dev rpm
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
- name: Set version
id: ver
run: |
UPSTREAM=$(cat VERSION)
HASH=$(git rev-parse --short=8 HEAD)
echo "full=${UPSTREAM}-${HASH}" >> $GITHUB_OUTPUT
- name: Build all Linux platforms (with cmount)
run: |
go run bin/cross-compile.go \
-include '^linux/' \
-tags cmount \
"${{ steps.ver.outputs.full }}"
- name: Build FreeBSD / NetBSD / OpenBSD / Plan9 / Solaris / AIX
run: |
go run bin/cross-compile.go \
-include '^(freebsd|netbsd|openbsd|plan9|solaris|aix)' \
-no-clean \
-compile-only \
"${{ steps.ver.outputs.full }}"
- name: Upload Linux artifacts
uses: actions/upload-artifact@v7
with:
name: binaries-linux
path: build/*
retention-days: 7
# ── macOS (needs native cgo + macFUSE) ──
build-macos:
runs-on: macos-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- name: amd64
flags: '-include "^darwin/amd64" -cgo'
- name: arm64
flags: '-include "^darwin/arm64" -cgo -macos-arch arm64'
name: macOS ${{ matrix.name }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version: '~1.26.3'
check-latest: true
- name: Install macFUSE
run: |
unset HOMEBREW_NO_INSTALL_FROM_API
brew untap --force homebrew/core
brew untap --force homebrew/cask
brew update
brew install --cask macfuse
- name: Set version
id: ver
run: |
UPSTREAM=$(cat VERSION)
HASH=$(git rev-parse --short=8 HEAD)
echo "full=${UPSTREAM}-${HASH}" >> $GITHUB_OUTPUT
- name: Build
run: |
go run bin/cross-compile.go \
${{ matrix.flags }} \
-tags cmount \
"${{ steps.ver.outputs.full }}"
- name: Upload macOS artifacts
uses: actions/upload-artifact@v7
with:
name: binaries-macos-${{ matrix.name }}
path: build/*
retention-days: 7
# ── Windows (needs native cgo + WinFsp) ──
build-windows:
runs-on: windows-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version: '~1.26.3'
check-latest: true
- name: Install WinFsp and zip
run: |
choco install -y winfsp zip
echo "CPATH=C:\Program Files\WinFsp\inc\fuse;C:\Program Files (x86)\WinFsp\inc\fuse" >> $env:GITHUB_ENV
- name: Set version
id: ver
shell: bash
run: |
UPSTREAM=$(cat VERSION)
HASH=$(git rev-parse --short=8 HEAD)
echo "full=${UPSTREAM}-${HASH}" >> $GITHUB_OUTPUT
- name: Build Windows
shell: bash
run: |
go run bin/cross-compile.go \
-include '^windows/' \
-tags cmount \
"${{ steps.ver.outputs.full }}"
- name: Upload Windows artifacts
uses: actions/upload-artifact@v7
with:
name: binaries-windows
path: build/*
retention-days: 7
# ── Release ──
release:
needs: [build-linux, build-macos, build-windows]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v6
- name: Set release version
id: ver
run: |
UPSTREAM=$(cat VERSION)
HASH=$(git rev-parse --short=8 HEAD)
echo "full=${UPSTREAM}-${HASH}" >> $GITHUB_OUTPUT
echo "upstream=${UPSTREAM}" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: release-artifacts
merge-multiple: true
- name: List release files
run: find release-artifacts -type f | sort
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.ver.outputs.full }}
name: ${{ steps.ver.outputs.full }}
body: |
## Rclone with 123Pan ${{ steps.ver.outputs.full }}
**上游版本**: `${{ steps.ver.outputs.upstream }}`
**构建 commit**: `${{ github.sha }}`
### 新增功能
- **123pan**: Web/浏览器 API 后端(用户名密码登录,无需开发者凭证)
- **123open**: 官方 Open API 后端(OAuth2 Client Credentials)
### 支持的平台
Linux (amd64/386/arm/arm64/mips/mipsle) · macOS (amd64/arm64) · Windows (386/amd64/arm64) · FreeBSD · NetBSD · OpenBSD · Plan9 · Solaris · AIX
draft: false
prerelease: false
files: |
release-artifacts/**/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}