zed-discord-presence/.github/workflows/release.yml
Jozef Steinhübl eb3ed250fc
ci: use 7z on windows
yes, windows... must be different :)
2024-07-19 17:18:12 +02:00

92 lines
2.5 KiB
YAML

name: Release
on:
workflow_dispatch:
jobs:
check:
name: check
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: install rust
uses: ./.github/actions/install-rust
- name: check
uses: ./.github/actions/check
compile:
name: compile ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
needs: check
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
archive: tar.gz
- target: x86_64-apple-darwin
runner: macos-latest
archive: tar.gz
- target: aarch64-apple-darwin
runner: macos-latest
archive: tar.gz
- target: x86_64-pc-windows-msvc
runner: windows-latest
archive: zip
steps:
- name: checkout
uses: actions/checkout@v4
- name: install rust
uses: ./.github/actions/install-rust
with:
targets: "${{ matrix.target }}"
- name: build binary
run: cargo build -p discord-presence-lsp --verbose --locked --release --target ${{ matrix.target }}
- name: prepare for upload
shell: bash
id: vars
run: |
BIN_SUFFIX=""
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
BIN_SUFFIX=".exe"
fi
BIN_OUTPUT="target/${{ matrix.target }}/release/discord-presence-lsp${BIN_SUFFIX}"
ARCHIVE_NAME="discord-presence-lsp-${{ matrix.target }}"
mkdir tmp/
mkdir "tmp/${ARCHIVE_NAME}"
mv "${BIN_OUTPUT}" "tmp/${ARCHIVE_NAME}"
cp LICENSE "tmp/${ARCHIVE_NAME}"
cp lsp/README.md "tmp/${ARCHIVE_NAME}"
if [[ "${{ matrix.archive }}" == "tar.gz" ]]; then
ARCHIVE_PATH="tmp/${ARCHIVE_NAME}.tar.gz"
tar -czvf "${ARCHIVE_PATH}" -C "tmp/${ARCHIVE_NAME}" .
else
ARCHIVE_PATH="tmp/${ARCHIVE_NAME}.zip"
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
7z a "${ARCHIVE_PATH}" "tmp/${ARCHIVE_NAME}"
else
zip -r "${ARCHIVE_PATH}" "tmp/${ARCHIVE_NAME}"
fi
fi
echo "archive_name=${ARCHIVE_NAME}" >> $GITHUB_OUTPUT
echo "archive_path=${ARCHIVE_PATH}" >> $GITHUB_OUTPUT
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.vars.outputs.archive_name }}
path: |
${{ steps.vars.outputs.archive_path }}