Skip to content

Fix casing for configuration options #79

Fix casing for configuration options

Fix casing for configuration options #79

Workflow file for this run

name: Release
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Linting (rustfmt + clippy)
permissions:
contents: read
checks: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install rustup components (rustfmt, clippy)
run: rustup component add rustfmt clippy
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: giraffate/clippy-action@v1
with:
reporter: "github-pr-review"
github_token: ${{ secrets.GITHUB_TOKEN }}
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout main branch
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Run all tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
new-release:
name: Check if new release
continue-on-error: true
needs: [lint, test]
permissions:
contents: read
actions: write
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.crate-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Crate Version
id: crate-version
uses: colathro/crate-version@1.0.0
with:
file: "./Cargo.toml"
- uses: mukunku/tag-exists-action@v1.6.0
id: check-tag
with:
tag: v${{ steps.crate-version.outputs.version }}
- name: Fail if tag already exists
if: ${{ steps.check-tag.outputs.exists == 'true' }}
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
env:
GH_TOKEN: ${{ secrets. GITHUB_TOKEN }}
# This is just to ensure that there is actually a changelog entry
create-draft-release:
name: Check presence of CHANGELOG.md entry
needs: [new-release]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
with:
draft: true
changelog: "./CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
ref: "refs/tags/v${{ needs.new-release.outputs.version }}"
# Build and push to crates.io (to verify correctness) before tagging and creating the release.
publish:
name: Publish to crates.io
needs: [new-release, create-draft-release]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Publish crate to crates.io
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_LOGIN_TOKEN }}
ignore-unpublished-changes: true
- name: Push the crate version as a tag
id: tag_version
uses: mathieudutour/github-tag-action@v5.4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: "v"
custom_tag: ${{ needs.new-release.outputs.version }}
# Create the release for real.
create-release:
name: Create GitHub release
needs: [new-release, publish]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
with:
changelog: "./CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
ref: "refs/tags/v${{ needs.new-release.outputs.version }}"
upload-assets:
name: Upload binaries
needs: [new-release, create-release]
permissions:
contents: write
strategy:
matrix:
include:
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: universal-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: crates-lsp
target: ${{ matrix.target }}
token: ${{ secrets.GITHUB_TOKEN }}
ref: "refs/tags/v${{ needs.new-release.outputs.version }}"