Skip to content

Also bump npm versions #138

Also bump npm versions

Also bump npm versions #138

Workflow file for this run

name: Releases
on:
push:
tags:
- release-*
# TODO: github doesn't support regex matching in if expressions for some reason,
# so these jobs all expect zero-versioned release tags...
jobs:
wait_for_ci:
name: Wait for CI Workflow
runs-on: ubuntu-latest
steps:
- name: Wait for CI
uses: lewagon/wait-on-check-action@v1.0.0
with:
ref: ${{ github.ref }}
check-name: "Test on Rust stable"
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
cargo_publish_taplo:
name: Cargo publish taplo
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo-0')
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Publish to Crates.io
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_wait_seconds: 300
timeout_minutes: 60
command: cd crates/taplo && cargo publish --allow-dirty --token $CRATES_IO_TOKEN
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
cargo_publish_taplo_cli:
name: Cargo publish taplo-cli
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo-cli-0')
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Publish to Crates.io
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_wait_seconds: 300
timeout_minutes: 60
command: cd crates/taplo-cli && cargo publish --allow-dirty --token $CRATES_IO_TOKEN
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
cargo_publish_taplo_common:
name: Cargo publish taplo-common
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo-common-0')
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Publish to Crates.io
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_wait_seconds: 300
timeout_minutes: 60
command: cd crates/taplo-common && cargo publish --allow-dirty --token $CRATES_IO_TOKEN
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
cargo_publish_taplo_lsp:
name: Cargo publish taplo-lsp
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo-lsp-0')
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Publish to Crates.io
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_wait_seconds: 300
timeout_minutes: 60
command: cd crates/taplo-lsp && cargo publish --allow-dirty --token $CRATES_IO_TOKEN
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
cargo_publish_lsp_async_stub:
name: Cargo publish lsp-async-stub
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-lsp-async-stub-0')
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Publish to Crates.io
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_wait_seconds: 300
timeout_minutes: 60
command: cd crates/lsp-async-stub && cargo publish --allow-dirty --token $CRATES_IO_TOKEN
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
npm_publish_taplo_core:
name: NPM publish @taplo/core
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo__core-0')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v1
- name: Publish to NPM
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_wait_seconds: 300
timeout_minutes: 60
command: cd js/core && yarn install && yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
npm_publish_taplo_cli:
name: NPM publish @taplo/cli
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo__cli-0')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v1
- name: Build Core
working-directory: js/core
run: yarn install && yarn build
- name: Publish to NPM
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_wait_seconds: 300
timeout_minutes: 60
command: cd js/cli && yarn install && yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
npm_publish_taplo_lsp:
name: NPM publish @taplo/lsp
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo__lsp-0')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v1
- name: Build Core
working-directory: js/core
run: yarn install && yarn build
- name: Publish to NPM
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_wait_seconds: 300
timeout_minutes: 60
command: cd js/lsp && yarn install && yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
npm_publish_taplo_lib:
name: NPM publish @taplo/lib
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo__lib-0')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v1
- name: Build Core
working-directory: js/core
run: yarn install && yarn build
- name: Publish to NPM
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_wait_seconds: 300
timeout_minutes: 60
command: cd js/lib && yarn install && yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
cli_docker:
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo-cli-0')
steps:
- uses: actions/checkout@v3
- name: Retrieve release version
id: version
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF#refs/tags/release-taplo-cli-})" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push CLI alpine
uses: docker/build-push-action@v3
with:
file: "docker/cli-alpine.Dockerfile"
context: "."
platforms: linux/amd64
push: true
tags: tamasfe/taplo:latest,tamasfe/taplo:${{ env.RELEASE_VERSION }},tamasfe/taplo:${{ env.RELEASE_VERSION }}-alpine
- name: Build and push CLI Full alpine
uses: docker/build-push-action@v3
with:
file: "docker/cli-full-alpine.Dockerfile"
context: "."
platforms: linux/amd64
push: true
tags: tamasfe/taplo:full,tamasfe/taplo:${{ env.RELEASE_VERSION }}-full,tamasfe/taplo:${{ env.RELEASE_VERSION }}-full-alpine
build_cli_windows:
name: ${{ matrix.triple }}
runs-on: windows-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo-cli-0')
strategy:
fail-fast: false
matrix:
include:
- triple: i686-pc-windows-msvc
platform: x86
- triple: x86_64-pc-windows-msvc
platform: x86_64
# https://github.com/briansmith/ring/issues/1167
# - triple: aarch64-pc-windows-msvc
# platform: aarch64
steps:
- uses: actions/checkout@v2
- run: rustup update
- run: rustup target add ${{ matrix.triple }}
- name: Build taplo
run: |
cargo build --verbose --release --bin taplo --target ${{ matrix.triple }}
Compress-Archive -Path ./target/${{ matrix.triple }}/release/taplo.exe -DestinationPath ./taplo-windows-${{ matrix.platform }}.zip
- name: Build taplo-full
run: |
cargo build --verbose --release --bin taplo --target ${{ matrix.triple }} --features toml-test,lsp
# zip
Compress-Archive -Path ./target/${{ matrix.triple }}/release/taplo.exe -DestinationPath ./taplo-full-windows-${{ matrix.platform }}.zip
# gzip
$file = [System.IO.File]::Open('.\target\${{ matrix.triple }}\release\taplo.exe', [System.IO.FileMode]::Open)
$archive = [System.IO.File]::Create('.\taplo-full-windows-${{ matrix.platform }}.gz')
$compressor = [System.IO.Compression.GZipStream]::new($archive, [System.IO.Compression.CompressionMode]::Compress)
$file.CopyTo($compressor)
$compressor.Close()
- uses: actions/upload-artifact@v3
with:
name: taplo-windows-${{ matrix.platform }}
path: |
./taplo-*.gz
./taplo-*.zip
retention-days: 1
build_cli_linux_musl:
name: ${{ matrix.triple }}
runs-on: ubuntu-latest
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo-cli-0')
env:
CROSS_SYSROOT: /mnt/alpine-${{ matrix.platform }}
PACKAGES: >
zlib-static freetype-static fontconfig-static
libgit2-static libssh2-static openssl-libs-static
libssl3 gtk+3.0-dev http-parser-dev curl
build-base openssl-dev git lld clang
strategy:
fail-fast: false
matrix:
include:
- triple: i686-unknown-linux-musl
platform: x86
- triple: x86_64-unknown-linux-musl
platform: x86_64
- triple: aarch64-unknown-linux-musl
platform: aarch64
steps:
- uses: actions/checkout@v2
- name: Set up Alpine Linux for ${{ matrix.platform }} (target arch)
id: alpine-target
uses: jirutka/setup-alpine@v1
with:
arch: ${{ matrix.platform }}
branch: edge
packages: ${{ env.PACKAGES }}
shell-name: alpine-target.sh
- name: Set up Alpine Linux for x86_64 (build arch)
uses: jirutka/setup-alpine@v1
with:
arch: x86_64
packages: ${{ env.PACKAGES }}
volumes: ${{ steps.alpine-target.outputs.root-path }}:${{ env.CROSS_SYSROOT }}
shell-name: alpine.sh
# rustup-init is not available for x86
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --target ${{ matrix.triple }} --default-toolchain stable --profile minimal -y
shell: alpine.sh {0}
- name: Build ${{ matrix.triple }}
shell: alpine.sh {0}
env:
LIBZ_SYS_STATIC: 1
LIBSSH2_STATIC: 1
LIBGIT2_STATIC: 1
OPENSSL_STATIC: 1
OPENSSL_DIR: ${{ env.CROSS_SYSROOT }}/usr # static/dynamic lib workaround <3
OPENSSL_NO_VENDOR: 1 # don't even try to build without it on musl
PKG_CONFIG_ALL_STATIC: 1
PKG_CONFIG_LIBDIR: ${{ env.CROSS_SYSROOT }}/usr/lib/pkgconfig
RUSTFLAGS: -C target-feature=+crt-static -C linker=/usr/bin/ld.lld # link runtime static, use universal linker
CARGO_BUILD_TARGET: ${{ matrix.triple }}
SYSROOT: /dummy # workaround for https://github.com/rust-lang/pkg-config-rs/issues/102
CC: clang
run: |
# Workaround for https://github.com/rust-lang/pkg-config-rs/issues/102
echo -e '#!/bin/sh\nPKG_CONFIG_SYSROOT_DIR=${{ env.CROSS_SYSROOT }} exec pkgconf "$@"' \
| install -m755 /dev/stdin pkg-config
export PKG_CONFIG="$(pwd)/pkg-config"
cargo build --verbose --release --bin taplo
gzip -c ./target/${{ matrix.triple }}/release/taplo > ./taplo-linux-${{ matrix.platform }}.gz
cargo build --verbose --release --bin taplo --features toml-test,lsp
gzip -c ./target/${{ matrix.triple }}/release/taplo > ./taplo-full-linux-${{ matrix.platform }}.gz
- uses: actions/upload-artifact@v3
with:
name: taplo-linux-${{ matrix.platform }}
path: |
./taplo-*.gz
retention-days: 1
build_cli_macos:
name: ${{ matrix.triple }}
runs-on: macos-11
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo-cli-0')
strategy:
fail-fast: false
matrix:
include:
- triple: x86_64-apple-darwin
platform: x86_64
- triple: aarch64-apple-darwin
platform: aarch64
steps:
- uses: actions/checkout@v2
- run: rustup update
- run: rustup target add ${{ matrix.triple }}
- name: Build taplo
run: |
cargo build --verbose --release --bins --target ${{ matrix.triple }}
gzip -c ./target/${{ matrix.triple }}/release/taplo > ./taplo-darwin-${{ matrix.platform }}.gz
- name: Build taplo-full
run: |
cargo build --verbose --release --bins --target ${{ matrix.triple }} --features toml-test,lsp
gzip -c ./target/${{ matrix.triple }}/release/taplo > ./taplo-full-darwin-${{ matrix.platform }}.gz
- uses: actions/upload-artifact@v3
with:
name: taplo-macos-${{ matrix.platform }}
path: |
./taplo-*.gz
retention-days: 1
publish_cli:
name: Release Taplo CLI binaries
needs: [build_cli_windows, build_cli_linux_musl, build_cli_macos]
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: api
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Retrieve release version
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF#refs/tags/release-taplo-cli-})" >> $GITHUB_ENV
- run: |
gh release create --draft ${{ env.RELEASE_VERSION }} --title "Taplo CLI ${{ env.RELEASE_VERSION }}" --target $GITHUB_SHA taplo-windows-*/* taplo-macos-*/* taplo-linux-*/*
publish_vscode_extension:
name: Publish VSCode Extension
needs: ["wait_for_ci"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-even-better-toml-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Retrieve release version
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF#refs/tags/release-even-better-toml-})" >> $GITHUB_ENV
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Extension NPM Install
run: yarn
working-directory: editors/vscode
- name: Install vsce
run: npm install -g vsce
- name: Package Extension
run: vsce package --baseImagesUrl https://raw.githubusercontent.com/tamasfe/taplo/master/editors/vscode
working-directory: editors/vscode
env:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
- name: Publish extension to microsoft marketplace
run: vsce publish --baseImagesUrl https://raw.githubusercontent.com/tamasfe/taplo/master/editors/vscode -p $VSCE_TOKEN
working-directory: editors/vscode
env:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
- name: Install ovsx
run: npm install -g ovsx
- name: Publish Open VSX Extension
run: ovsx publish --baseImagesUrl https://raw.githubusercontent.com/tamasfe/taplo/master/editors/vscode -p $OPEN_VSX_TOKEN "even-better-toml-$RELEASE_VERSION.vsix"
working-directory: editors/vscode
env:
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}