You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
encrypted-dns-server/.github/workflows/release.yml

96 lines
2.8 KiB
YAML

name: Release
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
target_alias: linux-x86_64
bin_suffix: ''
archive_suffix: '.tar.bz2'
- os: windows-latest
target: x86_64-pc-windows-msvc
target_alias: win-x86_64-msvc
bin_suffix: '.exe'
archive_suffix: '.zip'
defaults:
run:
shell: bash
env:
ARCHIVE_PATH: encrypted-dns_${{ github.ref_name }}_${{ matrix.target_alias }}${{ matrix.archive_suffix }}
steps:
- uses: actions/checkout@master
- uses: hecrj/setup-rust-action@master
with:
rust-version: stable
targets: ${{ matrix.target }}
- name: Check Cargo availability
run: cargo --version
- name: Check Rustup default toolchain
run: rustup default | grep stable
- name: Build
run: |
echo 'lto = "fat"' >> Cargo.toml
env RUSTFLAGS="-C link-arg=-s" cargo build --release
mkdir encrypted-dns
cp target/release/encrypted-dns${{ matrix.bin_suffix }} encrypted-dns/
cp README.md example-encrypted-dns.toml encrypted-dns/
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
tar cjpf ${ARCHIVE_PATH} encrypted-dns
elif [ "${{ matrix.os }}" = "windows-latest" ]; then
"/C/Program Files/7-Zip/7z" a ${ARCHIVE_PATH} encrypted-dns
fi
- name: Install cargo-deb and build Debian package
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cargo install --debug cargo-deb
cargo deb --output=encrypted-dns_${{ github.ref_name }}_amd64.deb --no-build
- uses: actions/upload-artifact@master
with:
name: encrypted-dns_${{ matrix.target_alias }}
path: ${{ env.ARCHIVE_PATH }}
- uses: actions/upload-artifact@master
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: encrypted-dns_deb-amd64
path: encrypted-dns_${{ github.ref_name }}_amd64.deb
release:
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ github.ref_name }}
draft: true
prerelease: false
files: |
encrypted-dns_deb-amd64/*.deb
encrypted-dns_linux-x86_64/*.tar.bz2
encrypted-dns_win-x86_64-msvc/*.zip