Skip to content

fix build

fix build #83

Workflow file for this run

name: release
on:
push:
# TODO: debug
# branches:
# - main
jobs:
build:
name: Build
strategy:
matrix:
build:
# TODO: debug
# - target: x86_64-apple-darwin
# os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
# TODO: debug
# - target: x86_64-pc-windows-msvc
# os: windows-latest
# - target: aarch64-pc-windows-msvc
# os: windows-latest
runs-on: ${{ matrix.build.os }}
steps:
- uses: actions/checkout@v4
- name: Install target
run: rustup target add ${{ matrix.build.target }}
- name: Setup musl
run: sudo apt-get install -y musl-tools
if: endsWith(matrix.build.target, '-musl')
- uses: Swatinem/rust-cache@v2
- name: Build
env:
TARGET: ${{ matrix.build.target }}
shell: bash
run: |
declare output
output="$(
cargo build \
--workspace \
--release \
--target "$TARGET" \
--message-format=json \
| jq -r '.message.rendered // .executable // empty'
)"
{
echo 'ARTIFACT_PATHS<<EOF'
echo "$output"
echo 'EOF'
} >> "$GITHUB_ENV"
# TODO: debug
- run: |
echo "$ARTIFACT_PATHS"
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.build.target }}
path: ${{ env.ARTIFACT_PATHS }}
if-no-files-found: error
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Determine New Version
id: version
uses: zwaldowski/semver-release-action@v4
with:
dry_run: true
bump: minor
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set Env
env:
TAG: v${{ steps.version.outputs.version }}
run: echo "TAG=${TAG}" >> $GITHUB_ENV
- name: Install nk
run: |
# install nk
curl -fsSL 'https://raw.githubusercontent.com/ciiqr/nk/HEAD/install.sh' | bash
# add to path
echo "${HOME}/.nk/bin" >> $GITHUB_PATH
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move executables
run: |
# TODO: debug
tree artifacts
for file in artifacts/*/*; do
exe="$(basename "$file")"
plugin="${exe%\.exe}"
target="$(basename "$(dirname "$file")")"
parent="${plugin}/assets/${target}"
mkdir -p "$parent"
mv "$file" "${parent}/${exe}"
chmod +x "${parent}/${exe}"
done
- name: Build assets
env:
REPOSITORY_NAME: ${{ github.event.repository.name }}
run: |
nk plugin pack \
--owner "$GITHUB_REPOSITORY_OWNER" \
--repo "$REPOSITORY_NAME" \
--version "$TAG" \
./*/plugin.yml
- name: Create Release
env:
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# TODO: debug
echo gh release create \
--title "$TAG" \
--notes '' \
"$TAG" \
manifest.yml *.tar.gz