71 lines
2.5 KiB
YAML
71 lines
2.5 KiB
YAML
name: Build and upload CLI
|
|
|
|
on:
|
|
create:
|
|
tags:
|
|
- 'v*'
|
|
repository_dispatch:
|
|
types: [wf-cli]
|
|
|
|
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
|
|
shell: bash
|
|
run: echo ::set-output name=VERSION::"$([[ "$GITHUB_REF" == refs/tags/v* ]] && echo ${GITHUB_REF#refs/tags/v} || echo '0.0.0')"
|
|
- name: Get file name
|
|
id: file
|
|
shell: bash
|
|
run: echo ::set-output name=FILE::${{ steps.version.outputs.VERSION }}-${{ matrix.ARCH }}${{ matrix.EXT }}
|
|
- name: Set up Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
default: true
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '^1.14.0'
|
|
- name: Set up GCC (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
Invoke-WebRequest 'https://wilsonl.in/TDM-GCC-64.7z' -OutFile C:\gcc.7z
|
|
7z x C:\gcc.7z -oC:\
|
|
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
|
|
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value "C:\TDM-GCC-64\bin;$oldpath"
|
|
- name: Build CLI
|
|
working-directory: ./cli
|
|
run: cargo build --release -vvv
|
|
- 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-cli${{ matrix.EXT }} hyperbuild/bin/${{ steps.file.outputs.FILE }}
|