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.

275 lines
8.3 KiB
YAML

on:
push:
tags:
- "v*"
name: Release
env:
RELEASE_SDB: skyd
RELEASE_SKYSH: skysh
RELEASE_BENCH: sky-bench
RELEASE_DIR: artifacts
GITHUB_REF: "${{ github.ref }}"
WINDOWS64_NAME: x86_64-windows
WINDOWS32_NAME: i686-windows
MACOS64_NAME: x86_64-macos
LINUX64_NAME: x86_64-linux-gnu
LINUX32_NAME: i686-linux-gnu
jobs:
build_64bit:
name: Build artifacts (64-bit)
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos, windows]
include:
- build: linux
os: ubuntu-latest
artifact: ${{ env.LINUX64_NAME }}
- build: macos
os: macos-latest
artifact: ${{ env.MACOS64_NAME }}
- build: windows
os: windows-latest
artifact: ${{ env.WINDOWS64_NAME }}
steps:
- uses: actions/checkout@v2
- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ matrix.build }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-cargo-registry-
- name: Cache Cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ matrix.build }}-cargo-index-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-cargo-index-
- name: Cache Cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ matrix.build }}-target-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-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 update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
- name: Build (Linux)
if: runner.os != 'Windows'
run: cargo build --release
- name: Build (Windows)
shell: cmd # Use cmd as the default shell to avoid perl path errors
if: runner.os == 'Windows'
run: cargo build --release
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
- name: Upload binaries
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: |
target/release/skyd
target/release/skysh
target/release/sky-bench
if: runner.os != "Windows"
- name: Upload binaries (Windows)
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: |
target/release/skyd.exe
target/release/skysh.exe
target/release/sky-bench.exe
if: runner.os == "Windows"
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: ${{ env.LINUX32_NAME }}
- build: windows
os: windows-latest
artifact: ${{ env.WINDOWS32_NAME }}
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: Build (Linux)
if: runner.os != 'Windows'
run: cargo build --release
- name: Build (Windows)
shell: cmd # Use cmd as the default shell to avoid perl path errors
if: runner.os == 'Windows'
run: cargo build --release
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
- name: Upload binaries
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: |
target/release/skyd
target/release/skysh
target/release/sky-bench
if: runner.os != "Windows"
- name: Upload binaries (Windows)
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: |
target/release/skyd.exe
target/release/skysh.exe
target/release/sky-bench.exe
if: runner.os == "Windows"
release:
name: Release Tier 1
needs:
- build_64bit
- build_32bit
runs-on: ubuntu-latest
steps:
- 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: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
prerelease: true
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Release Linux bundle (x86_64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.LINUX64_NAME }}
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX64_NAME }}.zip
- name: Release Windows bundle (x86_64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.WINDOWS64_NAME }}
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS64_NAME }}.zip
- name: Release MacOS bundle (x86_64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.MACOS64_NAME }}
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS64_NAME }}.zip
- name: Release Linux bundle (i686)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.LINUX64_NAME }}
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX32_NAME }}.zip
- name: Release Windows bundle (i686)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TDBB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.WINDOWS64_NAME }}
asset_content_type: application/octet-stream
asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS32_NAME }}.zip