build: publish v0.1.4 #26
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: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
build-binaries: | |
name: Build Binaries | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, windows-latest, macos-latest] | |
arch: | |
- x64 | |
- arm64 | |
exclude: | |
- platform: windows-latest | |
arch: arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Tools | |
uses: ./.github/actions/install-tools | |
- name: Set up MSVC Environment | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{ matrix.arch }} | |
- name: Remove Git link.exe from PATH | |
if: runner.os == 'Windows' | |
run: | | |
echo "Original PATH: %PATH%" | |
set PATH=%PATH:"C:\Program Files\Git\usr\bin";=% | |
echo "Modified PATH: %PATH%" | |
shell: cmd | |
- name: Check for Correct link.exe | |
if: runner.os == 'Windows' | |
run: where link | |
- name: Install Cross | |
if: runner.os != 'Windows' | |
run: cargo install cross --locked | |
- name: Build Binaries (Unix) | |
if: runner.os != 'Windows' | |
run: | | |
echo "Building for ${{ matrix.platform }} on architecture ${{ matrix.arch }}" | |
if [[ "${{ matrix.platform }}" == "ubuntu-latest" ]]; then | |
if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
cross build --release --target x86_64-unknown-linux-gnu | |
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then | |
cross build --release --target aarch64-unknown-linux-gnu | |
fi | |
elif [[ "${{ matrix.platform }}" == "macos-latest" ]]; then | |
if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
cross build --release --target x86_64-apple-darwin | |
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then | |
cross build --release --target aarch64-apple-darwin | |
fi | |
fi | |
shell: bash | |
- name: Build Binaries (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
echo "Building for ${{ matrix.platform }} on architecture ${{ matrix.arch }}" | |
cargo build --release --target x86_64-pc-windows-msvc | |
shell: cmd | |
- name: Move Binaries to Bin Folder (Unix) | |
if: runner.os != 'Windows' | |
run: | | |
if [[ "${{ matrix.platform }}" == "ubuntu-latest" ]]; then | |
if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
mkdir -p ./binaries/linux/x64 | |
cp target/x86_64-unknown-linux-gnu/release/todoctor ./binaries/linux/x64/todoctor | |
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then | |
mkdir -p ./binaries/linux/arm64 | |
cp target/aarch64-unknown-linux-gnu/release/todoctor ./binaries/linux/arm64/todoctor | |
fi | |
elif [[ "${{ matrix.platform }}" == "macos-latest" ]]; then | |
if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
mkdir -p ./binaries/macos/x64 | |
cp target/x86_64-apple-darwin/release/todoctor ./binaries/macos/x64/todoctor | |
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then | |
mkdir -p ./binaries/macos/arm64 | |
cp target/aarch64-apple-darwin/release/todoctor ./binaries/macos/arm64/todoctor | |
fi | |
fi | |
shell: bash | |
- name: Move Binaries to Bin Folder (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
mkdir binaries\windows\x64 | |
copy target\x86_64-pc-windows-msvc\release\todoctor.exe binaries\windows\x64\todoctor.exe | |
shell: cmd | |
- name: Upload Binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: todoctor-${{ matrix.platform }}-${{ matrix.arch }} | |
path: | | |
./binaries/windows/x64/ | |
./binaries/linux/x64/ | |
./binaries/linux/arm64/ | |
./binaries/macos/x64/ | |
./binaries/macos/arm64/ | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: build-binaries | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Tools | |
uses: ./.github/actions/install-tools | |
- name: Install Dependencies | |
uses: ./.github/actions/install-dependencies | |
- name: Build Static Assets | |
run: pnpm run build:preview | |
- name: Download Binaries for Linux x64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: todoctor-ubuntu-latest-x64 | |
path: ./binaries/linux/x64/ | |
- name: Download Binaries for Linux arm64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: todoctor-ubuntu-latest-arm64 | |
path: ./binaries/linux/arm64/ | |
- name: Download Binaries for macOS x64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: todoctor-macos-latest-x64 | |
path: ./binaries/macos/x64/ | |
- name: Download Binaries for macOS arm64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: todoctor-macos-latest-arm64 | |
path: ./binaries/macos/arm64/ | |
- name: Download Binaries for Windows x64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: todoctor-windows-latest-x64 | |
path: ./binaries/windows/x64/ | |
- name: Create GitHub Release | |
run: pnpm run ci:changelog | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Configure NPM Auth | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > ~/.npmrc | |
- name: Clear Package JSON | |
run: pnpm run ci:clear | |
- name: Publish to NPM | |
run: pnpm publish --access public --provenance |