Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish Deno package | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
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: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
default: true | |
- name: Install wasm-pack | |
working-directory: ./minify-html-wasm | |
shell: bash | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Build native module | |
working-directory: ./minify-html-wasm | |
shell: bash | |
run: TARGET=web ./build | |
- name: Install B2 CLI | |
run: | | |
wget -O b2 https://github.com/Backblaze/B2_Command_Line_Tool/releases/latest/download/b2-linux | |
chmod +x b2 | |
- name: Upload to B2 | |
run: | | |
./b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }} | |
for f in minify-html-wasm/pkg/*; do | |
if [[ "$f" == *.js ]]; then | |
content_type='text/javascript' | |
elif [[ "$f" == *.wasm ]]; then | |
content_type='application/wasm' | |
else | |
content_type='application/octet-stream' | |
fi | |
./b2 upload-file --contentType "$content_type" ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} "$f" "minify-html/deno/${{ steps.version.outputs.VERSION }}/$(basename "$f")" | |
done |