Merge pull request #10 from Vulpesx/inlay-hints #42
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Linting (rustfmt + clippy) | |
permissions: | |
checks: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- 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 | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v2 | |
- 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 | |
tag: | |
name: Tag & Publish | |
needs: [lint, test] | |
permissions: | |
contents: write | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.crate-version.outputs.version }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Crate Version | |
id: crate-version | |
uses: colathro/[email protected] | |
with: | |
file: "./Cargo.toml" | |
- uses: mukunku/[email protected] | |
id: check-tag | |
with: | |
tag: v${{ steps.crate-version.outputs.version }} | |
- name: Fail if tag already exists | |
if: ${{ steps.check-tag.outputs.exists == 'true' }} | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
core.setFailed('Tag already exists') | |
- name: Push the crate version as a tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag_prefix: "v" | |
custom_tag: ${{ steps.crate-version.outputs.version }} | |
create-release: | |
needs: tag | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: taiki-e/create-gh-release-action@v1 | |
with: | |
changelog: "./CHANGELOG.md" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: "refs/tags/v${{needs.tag.outputs.tag}}" | |
upload-assets: | |
needs: [tag, 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@v3 | |
- uses: taiki-e/upload-rust-binary-action@v1 | |
with: | |
bin: crates-lsp | |
target: ${{ matrix.target }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: "refs/tags/v${{needs.tag.outputs.tag}}" |