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.

267 lines
8.1 KiB
YAML

on:
push:
tags:
- "v*"
name: Release
env:
GITHUB_REF: "${{ github.ref }}"
CARGO_TERM_COLOR: always
jobs:
build_64bit:
name: Build artifacts (64-bit)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
artifact: x86_64-linux-gnu
rust: x86_64-unknown-linux-gnu
- os: macos-latest
artifact: x86_64-macos
rust: x86_64-apple-darwin
- os: windows-latest
artifact: x86_64-windows
rust: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v2
- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.rust }}-cargo-registry-
- name: Cache Cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.rust }}-cargo-index-
- name: Cache Cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.rust }}-target-
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Install Rust
run: |
rustup default stable
rustup target add ${{ matrix.rust }}
- name: Make bundle
run: make bundle
env:
RUST_BACKTRACE: 1
TARGET: ${{ matrix.rust }}
ARTIFACT: ${{ matrix.artifact }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Build Linux packages
run: |
make deb
mv *.deb skytable-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.deb
if: runner.os == 'Linux'
- name: Upload assets (bundles)
uses: actions/upload-artifact@v2
with:
name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
- name: Upload assets (Linux packages)
uses: actions/upload-artifact@v2
with:
name: skytable-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.deb
if: runner.os == 'Linux'
build_32bit:
name: Build artifacts (32-bit)
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, windows]
include:
- build: linux
os: ubuntu-latest
rust: i686-unknown-linux-gnu
artifact: i686-linux-gnu
- build: windows
os: windows-latest
artifact: i686-windows
rust: i686-pc-windows-msvc
steps:
- uses: actions/checkout@v2
- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.rust }}-cargo-registry-
- name: Cache Cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.rust }}-cargo-index-
- name: Cache Cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.rust }}-target-
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Install 32-bit tools (Linux)
run: sudo apt update && sudo apt install gcc-multilib -y
if: runner.os == 'Linux'
- name: Install Rust
run: rustup target add ${{ matrix.rust }}
- name: Make bundle
run: make bundle
env:
RUST_BACKTRACE: 1
TARGET: ${{ matrix.rust }}
ARTIFACT: ${{ matrix.artifact }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Build Linux packages
run: |
make deb
mv *.deb skytable-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.deb
if: runner.os == 'Linux'
- name: Upload assets (binaries)
uses: actions/upload-artifact@v2
with:
name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
- name: Upload assets (Linux packages)
uses: actions/upload-artifact@v2
with:
name: skytable-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.deb
if: runner.os == 'Linux'
build_musl:
name: Build Linux x86_64-musl (Tier 2)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: x86_64-unknown-linux-musl -cargo-registry-${{ hashFiles('Cargo.lock') }}
restore-keys: |
x86_64-unknown-linux-musl-cargo-registry-
- name: Cache Cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: x86_64-unknown-linux-musl-cargo-index-${{ hashFiles('Cargo.lock') }}
restore-keys: |
x86_64-unknown-linux-musl-cargo-index-
- name: Cache Cargo build
uses: actions/cache@v2
with:
path: target
key: x86_64-unknown-linux-musl-target-${{ hashFiles('Cargo.lock') }}
restore-keys: |
x86_64-unknown-linux-musl-target-
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Install MUSL tools
run: sudo apt update && sudo apt install musl-tools -y
- name: Install Rust
run: rustup target add x86_64-unknown-linux-musl
- name: Make bundle and packages
run: |
make bundle
make deb
mv *.deb skytable-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.deb
env:
RUST_BACKTRACE: 1
TARGET: x86_64-unknown-linux-musl
ARTIFACT: x86_64-linux-musl
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Upload assets
uses: actions/upload-artifact@v2
with:
name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.zip
path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.zip
- name: Upload assets (Linux packages)
uses: actions/upload-artifact@v2
with:
name: skytable-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.deb
release:
name: Release
needs:
- build_64bit
- build_32bit
- build_musl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Upload release binaries
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ steps.get_version.outputs.VERSION }}
run: |
hub release edit $(find . -type f -name "*.zip" -printf "-a %p ") -m "" "$TAG_NAME"
hub release edit $(find . -type f -name "*.deb" -printf "-a %p ") -m "" "$TAG_NAME"