Skip to content

去除 cli 选项中 --port 的简写 #318

去除 cli 选项中 --port 的简写

去除 cli 选项中 --port 的简写 #318

Workflow file for this run

name: release
on:
push:
branches: [ master ]
release:
types: [ published ]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup qemu
uses: docker/setup-qemu-action@v3
- name: setup docker buildx
uses: docker/setup-buildx-action@v3
- name: login docker hub
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: login github container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: setup version
if: github.event_name == 'release'
run: |
GIT_TAG=${{ github.event.release.tag_name }}
echo "IMAGE_TAG=${GIT_TAG#v}" >> $GITHUB_ENV
- name: build and push
uses: docker/build-push-action@v5
with:
context: .
provenance: false
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/candy:${{ env.IMAGE_TAG || 'latest' }}
ghcr.io/${{ github.actor }}/candy:${{ env.IMAGE_TAG || 'latest' }}
windows:
runs-on: windows-latest
steps:
- name: setup msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-gcc
mingw-w64-x86_64-spdlog
mingw-w64-x86_64-poco
- name: checkout
uses: actions/checkout@v4
- name: cache
uses: actions/cache@v4
with:
path: build
key: ${{ hashFiles('CMakeLists.txt') }}
- name: build
shell: msys2 {0}
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build
mkdir artifact
cp candy.cfg artifact
cp build/src/tun/wintun/bin/amd64/wintun.dll artifact
scripts/search-deps.sh build/src/main/candy.exe artifact
- name: set release package name
shell: bash
if: github.event_name == 'release'
run: |
GIT_TAG=${{ github.event.release.tag_name }}
echo "PKGNAME=candy_${GIT_TAG#v}+windows_amd64" >> $GITHUB_ENV
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-${{ github.event.release.tag_name || github.sha }}
path: artifact
- name: zip release
uses: thedoctor0/[email protected]
if: github.event_name == 'release'
with:
type: 'zip'
filename: ${{ env.PKGNAME }}.zip
directory: artifact
- name: upload release
uses: softprops/action-gh-release@v2
if: github.event_name == 'release'
with:
files: artifact/${{ env.PKGNAME }}.zip
opensuse:
runs-on: ubuntu-latest
steps:
- name: trigger openSUSE build
uses: distributhor/workflow-webhook@v3
with:
webhook_url: ${{ secrets.WEBHOOK_URL }}
webhook_secret: ${{ secrets.WEBHOOK_SECRET }}
deb:
strategy:
fail-fast: false
matrix:
image:
- "debian:12"
- "ubuntu:22.04"
- "ubuntu:24.04"
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: create ${{ matrix.image }} directory
run: |
mkdir debian
cp -r package/debian/* debian
cp README.md debian/candy-docs.docs
cp LICENSE debian/copyright
git fetch --tags origin
- name: setup artifact name
run: |
IMAGE_NAME=${{ matrix.image }}
echo "ARTIFACT_NAME=${IMAGE_NAME//:/}" >> $GITHUB_ENV
- name: build ${{ env.ARTIFACT_NAME }} deb
uses: jtdor/build-deb-action@v1
env:
DEB_BUILD_OPTIONS: noautodbgsym
EMAIL: [email protected]
USER: YangMame
EDITOR: true
with:
docker-image: ${{ matrix.image }}
buildpackage-opts: --build=binary --no-sign
extra-build-deps: git-buildpackage
before-build-hook: dch --package candy -v "$(git tag --sort=-creatordate | head -n1 | sed 's/v//g')+${{ env.ARTIFACT_NAME }}" -D stable --create "CI BUILD"
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}-${{ github.event.release.tag_name || github.sha }}
path: debian/artifacts
- name: upload release
uses: softprops/action-gh-release@v2
if: github.event_name == 'release'
with:
files: debian/artifacts/*.deb