0.9.4 #45
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: Publish packages | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
publish-binaries: | |
name: Build and publish binaries | |
strategy: | |
matrix: | |
rust_toolchain: [stable] | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
if: contains(github.ref, 'vscode-extension') != true | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.rust_toolchain }} | |
override: true | |
- name: Build CLI | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
cargo b --release --bin cddl | |
cp target/release/cddl cddl-linux-amd64 | |
chmod +x cddl-linux-amd64 | |
tar -czvf cddl-linux-amd64.tar.gz cddl-linux-amd64 | |
- name: Build CLI | |
if: matrix.os == 'macOS-latest' | |
run: | | |
cargo b --release --bin cddl | |
cp target/release/cddl cddl-darwin-amd64 | |
chmod +x cddl-darwin-amd64 | |
zip cddl-darwin-amd64.zip cddl-darwin-amd64 | |
- name: Build CLI | |
if: matrix.os == 'windows-latest' | |
shell: powershell | |
run: | | |
cargo b --release --bin cddl | |
cp target\release\cddl.exe cddl-windows-amd64.exe | |
Compress-Archive -Path .\cddl-windows-amd64.exe -DestinationPath cddl-windows-amd64.zip | |
- name: Upload binary asset | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./cddl-linux-amd64.tar.gz | |
asset_name: cddl-linux-amd64.tar.gz | |
asset_content_type: application/zip | |
- name: Upload binary asset | |
if: matrix.os == 'windows-latest' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./cddl-windows-amd64.zip | |
asset_name: cddl-windows-amd64.zip | |
asset_content_type: application/zip | |
- name: Upload binary asset | |
if: matrix.os == 'macOS-latest' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./cddl-darwin-amd64.zip | |
asset_name: cddl-darwin-amd64.zip | |
asset_content_type: application/zip | |
publish-docker: | |
name: Publish Docker | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'vscode-extension') != true | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Docker meta | |
id: docker_meta | |
uses: crazy-max/ghaction-docker-meta@v1 | |
with: | |
images: ghcr.io/anweiss/cddl-cli | |
tag-semver: | | |
{{version}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GHCR | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCRPAT }} | |
- name: Build and push image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
publish-npm: | |
name: Publish npm | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'vscode-extension') != true | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: wasm32-unknown-unknown | |
- name: Install Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "16" | |
- name: Install wasmpack | |
run: | | |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Build wasm default features | |
run: | | |
wasm-pack build --target nodejs --scope anweiss --release | |
- name: Build wasm lsp feature | |
run: | | |
wasm-pack build --target nodejs --scope anweiss --release --out-dir cddl-languageserver -- --features lsp | |
sed -i -e 's/"name": "@anweiss\/cddl"/"name": "@anweiss\/cddl-languageserver"/g' cddl-languageserver/package.json | |
- name: Publish to GPR | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" > ~/.npmrc | |
cp .npmrc pkg/ | |
cp .npmrc cddl-languageserver/ | |
cd pkg | |
npm publish --access=public | |
cd ../cddl-languageserver | |
npm publish --access=public | |
publish-vscode-extension: | |
name: Publish vscode extension | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Install Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "16" | |
- name: Deploy to Marketplace | |
working-directory: ./cddl-lsp | |
env: | |
VSCODE_MARKETPLACE_TOKEN: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} | |
run: | | |
sudo apt-get update && sudo apt-get install -y jq | |
npm install -g vsce | |
export TAG=`jq -r '.version' package.json` | |
vsce show --json anweiss.cddl-languageserver | jq -e --arg TAG "$TAG" -e '.versions[] | select(.version == $TAG)' | |
if [ "$?" -ne 0 ] | |
then | |
npm install | |
npm run deploy -- -p $VSCODE_MARKETPLACE_TOKEN | |
fi | |
publish-crate: | |
name: Publish crate | |
strategy: | |
matrix: | |
rust_toolchain: [stable] | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'vscode-extension') != true | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.rust_toolchain }} | |
override: true | |
- name: Login to crates.io | |
uses: actions-rs/cargo@v1 | |
with: | |
command: login | |
args: ${{ secrets.CratesIOToken }} | |
- name: Publish crate | |
uses: actions-rs/cargo@v1 | |
with: | |
command: publish | |
publish-website: | |
name: Publish website | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'vscode-extension') != true | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: wasm32-unknown-unknown | |
- name: Install wasmpack | |
run: | | |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Install node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "16" | |
- name: Build wasm | |
run: | | |
wasm-pack build --release | |
- name: Build web | |
run: | | |
cd www | |
npm install | |
npm run build | |
- name: Deploy web | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: www/dist |