Skip to content

chore: Always mark wit-language-server as the "latest" release whenev… #36

chore: Always mark wit-language-server as the "latest" release whenev…

chore: Always mark wit-language-server as the "latest" release whenev… #36

name: Release Please
on:
push:
branches:
- main
tags: "*"
repository_dispatch:
env:
DEFAULT_CRATE_NAME: wit_language_server
RUST_BACKTRACE: 1
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Install release-please
run: npm install --global [email protected]
- name: Update the Release PR
run: |
release-please release-pr \
--debug \
--token=${{ secrets.RELEASE_PLEASE_GH_TOKEN }} \
--repo-url=${{ github.repositoryUrl }} \
--config-file=.github/release-please/config.json \
--manifest-file=.github/release-please/manifest.json
- name: Publish the GitHub Release
run: |
release-please github-release \
--debug \
--prerelease \
--token=${{ secrets.RELEASE_PLEASE_GH_TOKEN }} \
--repo-url=${{ github.repositoryUrl }} \
--config-file=.github/release-please/config.json \
--manifest-file=.github/release-please/manifest.json
publish-to-crates-io:
name: Publish to crates.io (if necessary)
runs-on: ubuntu-latest
needs:
- release
concurrency: release-please-publish-crates-io
steps:
- uses: actions/checkout@v2
- name: Setup Rust
uses: dsherret/rust-toolchain-file@v1
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-workspaces
uses: taiki-e/install-action@v2
with:
tool: cargo-workspaces
- name: Publish
run: cargo workspaces publish --from-git --token "${{ secrets.CRATES_IO_TOKEN }}" --yes
publish-vscode-plugin:
name: Publish the VS Code plugin (${{ matrix.target }})
if: startsWith(github.ref, 'refs/tags/vscode-plugin-v')
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- runner: ubuntu-latest
target: linux-x64
- runner: macos-latest
target: darwin-x64
- runner: macos-latest
target: darwin-arm64
- runner: windows-latest
target: win32-x64
defaults:
run:
working-directory: plugins/vscode
shell: bash
steps:
- uses: actions/checkout@v2
- name: Setup Rust
uses: dsherret/rust-toolchain-file@v1
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: latest
cache: npm
cache-dependency-path: plugins/vscode/package-lock.json
- name: Install JavaScript Dependencies
run: npm ci
- name: Build
run: npm run package
- name: Package
run: npx @vscode/vsce package --no-update-package-json --target=${{ matrix.target }}
- name: Upload the vsix file to the GitHub Release
run: gh release upload ${TAG_NAME#refs/tags/} *.vsix
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_GH_TOKEN }}
TAG_NAME: ${{ github.ref }}
- name: Publish
run: npx @vscode/vsce publish --no-update-package-json --target=${{ matrix.target }}
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
upload-language-server-artifacts:
name: Upload the Language Server binary (${{ matrix.target }})
if: startsWith(github.ref, 'refs/tags/wit-language-server-v')
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- runner: ubuntu-latest
target: x86_64-unknown-linux
- runner: macos-latest
target: x86_64-apple-darwin
- runner: macos-latest
target: aarch64-apple-darwin
- runner: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v2
- name: Setup Rust
uses: dsherret/rust-toolchain-file@v1
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-dist
uses: taiki-e/install-action@v2
with:
tool: cargo-dist
- name: Record the Tag Name
run: echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- name: Compile
run: cargo build --workspace --verbose --profile=dist
- name: Generate the Archive
run: cargo dist --verbose=info --target=${{ matrix.target }} --tag=${TAG_NAME}
- name: Upload Release Artifacts
run: |
rm target/distrib/source.*
gh release upload ${TAG_NAME} target/distrib/wit-language-server*
- name: Mark this as the latest release
run: gh release edit --latest ${TAG_NAME}