ci: add new release job #6
Workflow file for this run
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: | |
pull_request: | |
branches: [ "master" ] | |
push: | |
tags: | |
# Regex for a version number such as 0.2.1 | |
- '*' | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-and-upload: | |
name: Build and upload | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- build: liunx | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
dependencies: sudo apt install musl-tools | |
- build: macos | |
os: macos-latest | |
target: x86_64-apple-darwin | |
dependencies: | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get release version | |
shell: bash | |
run: echo "VERSION=0.1.4" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: ${{ matrix.dependencies }} | |
- name: Build | |
run: cargo build --verbose --release --target ${{ matrix.target }} | |
- name: Build archive | |
shell: bash | |
run: | | |
binary_name="dts-lsp" | |
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" | |
mkdir "$dirname" | |
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" | |
tar -czf "$dirname.tar.gz" "$dirname" | |
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
files: | | |
${{ env.ASSET }} |