Skip to content

Commit

Permalink
files-windows-support: switched files plugin to rust
Browse files Browse the repository at this point in the history
  • Loading branch information
ciiqr committed Oct 22, 2023
1 parent b4e8775 commit 10c4436
Show file tree
Hide file tree
Showing 13 changed files with 1,205 additions and 239 deletions.
116 changes: 104 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,66 @@ on:
push:
branches:
- main
# TODO: remove
- files-windows-support
jobs:
build:
name: Build
strategy:
matrix:
build:
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
# TODO:
# - os: windows-latest
# target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.build.os }}
steps:
- uses: actions/checkout@v4
- name: Setup musl
run: |
rustup target add x86_64-unknown-linux-musl
sudo apt-get install -y musl-tools
echo 'LDFLAGS=-Wl,--copy-dt-needed-entries' >> $GITHUB_ENV
echo 'RUSTFLAGS=-C target-feature=+crt-static' >> $GITHUB_ENV
if: matrix.build.target == 'x86_64-unknown-linux-musl'
- name: Setup Apple Silicon
run: rustup target add aarch64-apple-darwin
if: matrix.build.target == 'aarch64-apple-darwin'
- uses: Swatinem/rust-cache@v2
# TODO: fix for windows...
- name: Build
env:
TARGET: ${{ matrix.build.target }}
run: |
declare output
output="$(
cargo build \
--workspace \
--release \
--target "$TARGET" \
--message-format=json \
| jq -r '.message.rendered // .executable // empty'
)"
echo "ARTIFACT_PATH=$output" >> $GITHUB_ENV
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.build.target }}
path: ${{ env.ARTIFACT_PATH }}
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Determine New Version
id: version
uses: zwaldowski/semver-release-action@v2
uses: zwaldowski/semver-release-action@v3
with:
dry_run: true
bump: minor
Expand All @@ -27,6 +78,20 @@ jobs:
# add to path
echo "${HOME}/.nk/bin" >> $GITHUB_PATH
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Move executables
run: |
for file in artifacts/*/*; do
plugin="$(basename "$file")"
target="$(basename "$(dirname "$file")")"
parent="${plugin}/assets/${target}"
mkdir -p "$parent"
mv "$file" "${parent}/${plugin}"
done
- name: Build assets
env:
REPOSITORY_NAME: ${{ github.event.repository.name }}
Expand All @@ -36,13 +101,40 @@ jobs:
--repo "$REPOSITORY_NAME" \
--version "$TAG" \
./*/plugin.yml
- name: Create Release
env:
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create \
--title "$TAG" \
--notes '' \
"$TAG" \
manifest.yml *.tar.gz
# TODO: DEBUG
- run: 'find . -type f'
- run: 'false'

# TODO: DEBUGGING
# - name: Create Release
# env:
# GITHUB_USER: ${{ github.repository_owner }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh release create \
# --title "$TAG" \
# --notes '' \
# "$TAG" \
# manifest.yml *.tar.gz

# TODO: DEBUG
# - name: Create Release
# env:
# GITHUB_USER: ${{ github.repository_owner }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# mkdir assets

# # move binaries to assets directory
# for path in artifacts/*; do
# declare artifact="$(basename "$path")"
# mv "${path}/nk"* "assets/${artifact}"
# done

# # create release
# gh release create \
# --title "$GITHUB_REF_NAME" \
# --notes '' \
# "$GITHUB_REF_NAME" \
# "assets/"*
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# nix
/.direnv/

# release assets
/target/
*.tar.gz
manifest.yml
1 change: 1 addition & 0 deletions .rtx.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
env_path = ['./bin']
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_width = 80
Loading

0 comments on commit 10c4436

Please sign in to comment.