Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scaffold script #112

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
retouche
sigmaSd committed Dec 14, 2022

Unverified

This user has not yet uploaded their public signing key.
commit e6f23d5c36db18952ddcb05199943853d7bb8e1d
80 changes: 40 additions & 40 deletions scaffold/action.yml
Original file line number Diff line number Diff line change
@@ -34,29 +34,29 @@ jobs:
- name: Build MacOS x86_64
if: runner.os == 'MacOS'
run: |
mv target/release/libg.dylib libg_x86_64.dylib
mv target/release/lib$NAME_HERE.dylib lib$NAME_HERE_x86_64.dylib

- name: Upload MacOS x86_64
if: runner.os == 'MacOS'
uses: svenstaro/upload-release-action@v2
with:
file: libg_x86_64.dylib
file: lib$NAME_HERE_x86_64.dylib
tag: ${{ github.event.inputs.tag }}
overwrite: true

- name: Release Linux lib
- name: Upload Linux
if: runner.os == 'Linux'
uses: svenstaro/upload-release-action@v2
with:
file: target/release/libg.so
file: target/release/lib$NAME_HERE.so
tag: ${{ github.event.inputs.tag }}
overwrite: true

- name: Release Windows lib
- name: Upload Windows
if: runner.os == 'Windows'
uses: svenstaro/upload-release-action@v2
with:
file: target/release/g.dll
file: target/release/$NAME_HERE.dll
tag: ${{ github.event.inputs.tag }}
overwrite: true

@@ -65,48 +65,48 @@ jobs:
# with:
# version: 0.9.0

#- name: Build MacOS aarch64 lib
#- name: Build MacOS aarch64
# if: runner.os == 'Linux'
# run: |
# rustup target add aarch64-apple-darwin
# cargo install cargo-zigbuild
# cargo zigbuild --release --target aarch64-apple-darwin
# mv target/aarch64-apple-darwin/release/libg.dylib libg_aarch64.dylib
# mv target/aarch64-apple-darwin/release/lib$NAME_HERE.dylib lib$NAME_HERE_aarch64.dylib

# - name: Upload MacOS aarch64
# if: runner.os == 'Linux'
# uses: svenstaro/upload-release-action@v2
# with:
# file: libg_aarch64.dylib
# tag: ${{ github.event.inputs.tag }}
# overwrite: true
#- name: Upload MacOS aarch64
# if: runner.os == 'Linux'
# uses: svenstaro/upload-release-action@v2
# with:
# file: lib$NAME_HERE_aarch64.dylib
# tag: ${{ github.event.inputs.tag }}
# overwrite: true


#uncomment to automaticly generate bindings
# - name: Setup Deno
# if: runner.os == 'Linux'
# uses: denoland/setup-deno@v1

# - name: Generate bindings
# if: runner.os == 'Linux'
# run: |
# libUrl=https://github.com/$GITHUB_REPOSITORY/releases/download/${{ github.event.inputs.tag }}
# touch src/lib.rs # Required to trigger cargo build correctly (to generate bindings.json)
# deno run -A -r https://deno.land/x/deno_bindgen/cli.ts --release=$libUrl

# - name: Commit bindings
# if: runner.os == 'Linux'
# run: |
# git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
# git config --local user.name "github-actions[bot]"
# git add bindings/bindings.ts
# git commit -m "update bindings to ${{ github.event.inputs.tag }}"

# - name: Push changes
# if: runner.os == 'Linux'
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}
#- name: Setup Deno
# if: runner.os == 'Linux'
# uses: denoland/setup-deno@v1

#- name: Generate bindings
# if: runner.os == 'Linux'
# run: |
# libUrl=https://github.com/$GITHUB_REPOSITORY/releases/download/${{ github.event.inputs.tag }}
# touch src/lib.rs # Required to trigger cargo build correctly (to generate bindings.json)
# deno run -A -r https://deno.land/x/deno_bindgen/cli.ts --release=$libUrl

#- name: Commit bindings
# if: runner.os == 'Linux'
# run: |
# git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
# git config --local user.name "github-actions[bot]"
# git add bindings/bindings.ts
# git commit -m "update bindings to ${{ github.event.inputs.tag }}"

#- name: Push changes
# if: runner.os == 'Linux'
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}


10 changes: 3 additions & 7 deletions scaffold/scaffold.ts
Original file line number Diff line number Diff line change
@@ -65,16 +65,12 @@ console.log(
Deno.mkdirSync(libPath + "/.github/workflows", { recursive: true });
const githubAction = await fetch(
import.meta.resolve("./action.yml"),
).then((r) => r.text());
).then((r) => r.text()).then((a) => a.replaceAll("$NAME_HERE", libName));
Deno.writeTextFileSync(
libPath + "/.github/workflows/release.yml",
githubAction,
);

console.log("1- cd ", libPath);
console.log(
"2- If you're developing locally run deno_bindgen\n" +
"If you want to create release bindings, you can trigger a github action build manually in {github_repo}/actions\n" +
"Then use deno_bindgen --release={github_repo}/releases/download/{tag_name}",
);
console.log("3- Run deno run --unstable lib.ts");
console.log("2- Run deno_bindgen to develop locally");
console.log("3- Run deno run --unstable mod.ts");