minify-html/.github/workflows/cli.yml

75 lines
2.3 KiB
YAML
Raw Normal View History

name: Build and upload CLI
on:
create:
tags:
- 'v*'
2020-06-18 21:06:22 -04:00
repository_dispatch:
types: [wf-cli]
jobs:
cli:
runs-on: ${{ matrix.os }}
strategy:
matrix:
2020-07-10 16:00:48 -04:00
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
ARCH: linux-x86_64
MIME: application/octet-stream
EXT: ''
- 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-06-18 23:00:25 -04:00
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
2020-01-01 07:39:45 -05:00
shell: bash
run: echo ::set-output name=FILE::${{ steps.version.outputs.VERSION }}-${{ matrix.ARCH }}${{ matrix.EXT }}
2020-07-10 15:02:08 -04:00
- name: Set up Rust (macOS, Linux)
if: runner.os != 'Windows'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
2020-07-10 15:02:08 -04:00
- name: Set up Rust (Windows)
if: runner.os == 'Windows'
uses: actions-rs/toolchain@v1
with:
toolchain: stable-gnu
profile: minimal
default: true
- name: Set up Go
uses: actions/setup-go@v2
2020-07-10 13:52:59 -04:00
with:
go-version: '^1.14.0'
- name: Set up GCC (Windows)
2020-07-10 12:37:51 -04:00
if: runner.os == 'Windows'
2020-07-10 15:02:08 -04:00
run: .\.github\workflows\gcc.ps1
- name: Run prebuild steps
shell: bash
run: bash ./prebuild.sh
- name: Build CLI
2020-06-18 19:49:48 -04:00
working-directory: ./cli
2020-07-10 12:37:51 -04:00
run: cargo build --release -vvv
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 }}
2020-07-11 11:29:34 -04:00
b2 upload-file --contentType ${{ matrix.MIME }} ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./cli/target/release/minify-html-cli${{ matrix.EXT }} minify-html/bin/${{ steps.file.outputs.FILE }}