2020-01-01 04:47:49 -05:00
|
|
|
name: Build and upload CLI
|
|
|
|
|
|
|
|
on:
|
|
|
|
create:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
cli:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
ARCH: linux-x86_64
|
|
|
|
MIME: application/octet-stream
|
|
|
|
EXT: ''
|
|
|
|
- os: windows-latest
|
|
|
|
ARCH: windows-x86_64
|
|
|
|
MIME: application/vnd.microsoft.portable-executable
|
|
|
|
EXT: '.exe'
|
|
|
|
- os: macos-latest
|
|
|
|
ARCH: macos-x86_64
|
|
|
|
MIME: application/octet-stream
|
|
|
|
EXT: ''
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Get version
|
|
|
|
id: version
|
2020-01-01 07:39:45 -05:00
|
|
|
shell: bash
|
2020-01-01 04:47:49 -05:00
|
|
|
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
|
|
|
|
- name: Get file name
|
|
|
|
id: file
|
2020-01-01 07:39:45 -05:00
|
|
|
shell: bash
|
2020-01-01 04:47:49 -05:00
|
|
|
run: echo ::set-output name=FILE::${{ steps.version.outputs.VERSION }}-${{ matrix.ARCH }}${{ matrix.EXT }}
|
|
|
|
- name: Set up Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
2020-01-31 07:30:14 -05:00
|
|
|
toolchain: 1.39.0
|
2020-01-01 04:47:49 -05:00
|
|
|
profile: minimal
|
|
|
|
default: true
|
|
|
|
- name: Build CLI
|
2020-06-18 19:49:48 -04:00
|
|
|
working-directory: ./cli
|
2020-01-01 04:47:49 -05:00
|
|
|
run: cargo build --release
|
2020-06-18 19:49:48 -04:00
|
|
|
- name: Install B2 CLI (macOS, Linux)
|
|
|
|
if: runner.os != 'Windows'
|
|
|
|
run: |
|
|
|
|
sudo pip install setuptools
|
|
|
|
sudo pip install --upgrade b2
|
|
|
|
- name: Install B2 CLI (Windows)
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
pip install --upgrade b2
|
|
|
|
- name: Upload to B2
|
|
|
|
run: |
|
|
|
|
b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
|
|
|
|
b2 upload-file --contentType ${{ matrix.MIME }} ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./cli/target/release/hyperbuild${{ matrix.EXT }} hyperbuild/bin/${{ steps.file.outputs.FILE }}
|