Skip to content

feat: add metadata support #17

feat: add metadata support

feat: add metadata support #17

Workflow file for this run

name: Build and Release ODIN CLI Tool
on:
push:
tags:
- "v*.*.*"
jobs:
ensure_version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check version match
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
FILE_VERSION=$(jq -r '.version' src/mod.json)
if [[ "$TAG_VERSION" == "$FILE_VERSION" ]]; then
exit 0
else
echo "Version mismatch: Tag is $TAG_VERSION, but mod.json has $FILE_VERSION"
exit 1
fi
build:
needs: ensure_version
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
triplet: x86_64-unknown-linux-gnu
binary: odin-linux
- os: macos-latest
triplet: x86_64-apple-darwin
binary: odin-macos-x86
- os: macos-latest
triplet: aarch64-apple-darwin
binary: odin-macos-arm
- os: windows-latest
triplet: x86_64-pc-windows-msvc
binary: odin-windows.exe
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v2
with:
deno-version-file: .dvmrc
- name: Compile Binary
run: |
deno task build
mv odin${{ matrix.os == 'windows-latest' && '.exe' || '' }} ${{ matrix.binary }}
env:
DENO_BUILD_TARGET: ${{ matrix.triplet }}
- name: Set Exacutable Flag
if: matrix.os != 'windows-latest'
run: chmod +x ${{ matrix.binary }}
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}
path: ${{ matrix.binary }}
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Binaries
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
./odin-linux
./odin-macos-x86
./odin-macos-arm
./odin-windows.exe
draft: false
prerelease: false
name: Release ${{ github.ref_name }}