108 lines
2.8 KiB
YAML
108 lines
2.8 KiB
YAML
name: "Upload Release Artifacts"
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build-deb:
|
|
name: 'Build Debian packages'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Creating environment variables
|
|
run: echo "release_version=${git_ref#v}" >> $GITHUB_ENV
|
|
env:
|
|
git_ref: ${{ github.ref }}
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
- name: Install Dependencies
|
|
env:
|
|
ACCEPT_EULA: Y
|
|
run: sudo apt-get -y update && sudo apt-get install -f && sudo apt-get -y install libsqlite3-dev libclang-9-dev
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.cargo/registry
|
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Cache cargo index
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.cargo/git
|
|
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Cache cargo build
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: target
|
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Cache cargo bin
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.cargo/bin
|
|
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Build
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --verbose
|
|
- name: Test
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --verbose
|
|
- name: Install cargo-deb (if missing)
|
|
run: |
|
|
which cargo-deb || cargo install cargo-deb
|
|
- name: Build Debian Server Package
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: deb
|
|
args: -p server
|
|
- name: Build Debian Client Package
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: deb
|
|
args: -p client
|
|
- name: Save DEBs
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: packaged-deb
|
|
path: target/debian/*.deb
|
|
|
|
build-rpm:
|
|
name: 'Build RPM packages'
|
|
continue-on-error: true
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
distros: ['fedora:32', 'fedora:33', 'centos:8']
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Build RPMs
|
|
run: rpm/build-package.sh ${{ matrix.distros }}
|
|
- name: Save RPMs
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: packaged-rpm
|
|
path: target/rpm/*.rpm
|
|
|
|
release:
|
|
name: 'Release packages'
|
|
runs-on: ubuntu-latest
|
|
needs: [build-deb, build-rpm]
|
|
steps:
|
|
- name: Get artifacts
|
|
uses: actions/download-artifact@v2
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
packaged-deb/*.deb
|
|
packaged-rpm/*.rpm
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|