2020-01-01 04:47:49 -05:00
|
|
|
name: Build and upload CLI
|
|
|
|
|
|
|
|
on:
|
2021-08-05 22:22:24 -04:00
|
|
|
push:
|
2020-01-01 04:47:49 -05:00
|
|
|
tags:
|
|
|
|
- 'v*'
|
2021-08-05 22:22:24 -04:00
|
|
|
workflow_dispatch:
|
2020-01-01 04:47:49 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
cli:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-08-07 21:14:58 -04:00
|
|
|
os: [macos-11.0, ubuntu-18.04, windows-2019, self-hosted]
|
2020-01-01 04:47:49 -05:00
|
|
|
include:
|
2021-04-06 04:50:24 -04:00
|
|
|
- os: macos-11.0
|
2020-01-01 04:47:49 -05:00
|
|
|
ARCH: macos-x86_64
|
|
|
|
MIME: application/octet-stream
|
|
|
|
EXT: ''
|
2021-04-06 04:50:24 -04:00
|
|
|
- os: ubuntu-18.04
|
2020-07-22 07:52:54 -04:00
|
|
|
ARCH: linux-x86_64
|
|
|
|
MIME: application/octet-stream
|
|
|
|
EXT: ''
|
2021-04-06 04:50:24 -04:00
|
|
|
- os: windows-2019
|
2020-07-22 07:52:54 -04:00
|
|
|
ARCH: windows-x86_64
|
|
|
|
MIME: application/vnd.microsoft.portable-executable
|
|
|
|
EXT: '.exe'
|
2021-08-07 21:14:58 -04:00
|
|
|
- os: self-hosted
|
|
|
|
ARCH: linux-arm64
|
|
|
|
MIME: application/octet-stream
|
|
|
|
EXT: ''
|
2020-01-01 04:47:49 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2021-08-07 22:54:56 -04:00
|
|
|
|
2020-01-01 04:47:49 -05:00
|
|
|
- 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')"
|
2021-08-07 22:54:56 -04:00
|
|
|
|
2020-01-01 04:47:49 -05:00
|
|
|
- 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 }}
|
2021-08-07 22:54:56 -04:00
|
|
|
|
2020-07-22 07:52:54 -04:00
|
|
|
- name: Set up Rust
|
2020-01-01 04:47:49 -05:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
2020-07-03 06:42:10 -04:00
|
|
|
toolchain: stable
|
2020-01-01 04:47:49 -05:00
|
|
|
profile: minimal
|
|
|
|
default: true
|
2021-08-07 22:54:56 -04:00
|
|
|
|
2020-07-22 07:56:07 -04:00
|
|
|
- name: Set up GCC (Windows)
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: .\.github\workflows\gcc.ps1
|
2021-08-07 22:54:56 -04:00
|
|
|
|
2020-07-10 15:02:08 -04:00
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
2020-07-10 13:52:59 -04:00
|
|
|
with:
|
|
|
|
go-version: '^1.14.0'
|
2021-08-07 22:54:56 -04:00
|
|
|
|
2020-07-11 09:25:36 -04:00
|
|
|
- name: Run prebuild steps
|
|
|
|
shell: bash
|
|
|
|
run: bash ./prebuild.sh
|
2021-08-07 22:54:56 -04:00
|
|
|
|
2020-01-01 04:47:49 -05:00
|
|
|
- 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
|
2021-08-07 22:54:56 -04:00
|
|
|
|
2020-06-18 19:49:48 -04:00
|
|
|
- name: Upload to B2
|
2021-08-07 22:54:56 -04:00
|
|
|
uses: wilsonzlin/b2-upload-action@v1.0.0
|
|
|
|
with:
|
|
|
|
bucket: ${{ secrets.CICD_CLI_B2_BUCKET_NAME }}
|
|
|
|
uploadKey: minify-html/bin/${{ steps.file.outputs.FILE }}
|
|
|
|
keyId: ${{ secrets.CICD_CLI_B2_KEY_ID }}
|
|
|
|
applicationKey: ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
|
|
|
|
file: ./cli/target/release/minify-html-cli${{ matrix.EXT }}
|
|
|
|
contentType: ${{ matrix.MIME }}
|