chore: rename variable name. #281
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: Release CLI and VSCode Extension | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
TOMBI_VERSION: null | |
jobs: | |
delete-old-dev-artifacts: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: | | |
tombi-cli-0.0.0-* | |
tombi-vscode-0.0.0-* | |
release-cli-and-vscode: | |
needs: [delete-old-dev-artifacts] | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
vscode_target: linux-x64 | |
# | |
# FIXME: fails to build on those targets | |
# | |
# - os: ubuntu-20.04 | |
# target: aarch64-unknown-linux-gnu | |
# vscode_target: linux-arm64 | |
# - os: ubuntu-20.04 | |
# target: arm-unknown-linux-gnueabihf | |
# vscode_target: linux-armhf | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
vscode_target: win32-x64 | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
vscode_target: win32-arm64 | |
- os: macos-13 | |
target: x86_64-apple-darwin | |
vscode_target: darwin-x64 | |
- os: macos-14 | |
target: aarch64-apple-darwin | |
vscode_target: darwin-arm64 | |
name: dist (${{ matrix.target }}) | |
runs-on: ${{ matrix.os }} | |
env: | |
TOMBI_TARGET: ${{ matrix.target }} | |
VSCODE_TARGET: ${{ matrix.vscode_target }} | |
GITHUB_REF: ${{ (github.ref) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
run: | | |
rustup update --no-self-update stable | |
rustup target add ${{ matrix.target }} | |
- uses: pnpm/action-setup@v4 | |
with: | |
run_install: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Update apt repositories | |
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'arm-unknown-linux-gnueabihf' | |
run: sudo apt-get update | |
- name: Install AArch64 target toolchain | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: sudo apt-get install gcc-aarch64-linux-gnu | |
- name: Install ARM target toolchain | |
if: matrix.target == 'arm-unknown-linux-gnueabihf' | |
run: sudo apt-get install gcc-arm-linux-gnueabihf | |
- run: pnpm install && pnpm run build | |
working-directory: ./editors/vscode | |
- run: which pnpm | |
- name: Run xtask set-version on non-Windows | |
if: matrix.os != 'windows-latest' | |
run: cargo xtask set-version >> $GITHUB_ENV | |
- name: Run xtask set-version on Windows | |
if: matrix.os == 'windows-latest' | |
run: cargo xtask set-version >> $env:GITHUB_ENV | |
- name: Get TOMBI_VERSION | |
if: matrix.os != 'windows-latest' | |
run: echo "TOMBI_VERSION=${{ env.TOMBI_VERSION }}" | |
- name: Rub xtask dist | |
run: cargo xtask dist | |
env: | |
RUST_BACKTRACE: "1" | |
# FIXME: pnpm cannot exec `cargo xtask dist` on windows. | |
# See https://github.com/matklad/xshell/issues/82 | |
- name: Package VSCode Extension for Windows | |
if: matrix.os == 'windows-latest' | |
run: pnpm exec vsce package --no-dependencies -o "../../dist/tombi-vscode-${{ env.TOMBI_VERSION }}-${{ matrix.vscode_target }}.vsix" --target ${{ matrix.vscode_target }} | |
working-directory: ./editors/vscode | |
- name: Publish VSCode Extension | |
run: pnpm run publish --pat ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath "../../dist/tombi-vscode-${{ env.TOMBI_VERSION }}-${{ matrix.vscode_target }}.vsix" | |
if: startsWith(github.ref, 'refs/tags/') | |
working-directory: ./editors/vscode | |
- name: Upload tombi-vscode artifacts | |
uses: actions/upload-artifact@v4 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: tombi-vscode-${{ env.TOMBI_VERSION }}-${{ matrix.target }} | |
path: | | |
dist/tombi-cli-${{ env.TOMBI_VERSION }}-* | |
dist/tombi-vscode-${{ env.TOMBI_VERSION }}-* |