Skip to content

Add permissions to workflow #26

Add permissions to workflow

Add permissions to workflow #26

Workflow file for this run

name: Package and Release
on:
workflow_dispatch:
inputs:
create_release:
description: 'Create new release'
required: true
type: boolean
push:
tags:
- v*
permissions:
contents: write
jobs:
build-macArm:
name: Build - Mac (ARM)
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
runs-on: macos-latest-xlarge
strategy:
matrix:
os: [macos-latest]
steps:
- name: Checkout code with submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Use node 20
uses: actions/setup-node@v3
with:
node-version: "20.x"
- name: Yarn install
run: yarn install
- name: Add macOS certs
if: matrix.os == 'macos-latest' && startsWith(github.ref, 'refs/tags/')
run: chmod +x add-osx-cert.sh && ./add-osx-cert.sh
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
- name: LLAMA - Make
id: make_build
run: |
cd llama.cpp && LLAMA_METAL=1 make && cd ..
- name: LLAMA - Create directory
id: make_directory
run: |
mkdir -p models/mac/llama
- name: LLAMA - Copy files
id: copy_mac
run: |
cp llama.cpp/server models/mac/llama && cp llama.cpp/ggml-metal.metal models/mac/llama
- name: Make
run: yarn make
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
**/*.dmg
**/*.zip
# build-macIntel:
# name: Build - Mac (Intel)
# if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
# runs-on: macos-latest
# strategy:
# matrix:
# os: [macos-latest]
# steps:
# - name: Checkout code with submodules
# uses: actions/checkout@v3
# with:
# submodules: recursive
# - name: Use node 20
# uses: actions/setup-node@v3
# with:
# node-version: "20.x"
# - name: Yarn install
# run: yarn install
# - name: Add macOS certs
# if: matrix.os == 'macos-latest' && startsWith(github.ref, 'refs/tags/')
# run: chmod +x add-osx-cert.sh && ./add-osx-cert.sh
# env:
# CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
# CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
# - name: LLAMA - Make
# id: make_build
# run: |
# cd llama.cpp && LLAMA_METAL=1 make && cd ..
# - name: LLAMA - Create directory
# id: make_directory
# run: |
# mkdir -p models/mac/llama
# - name: LLAMA - Copy files
# id: copy_mac
# run: |
# cp llama.cpp/server models/mac/llama && cp llama.cpp/ggml-metal.metal models/mac/llama
# - name: Make
# run: yarn make
# env:
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
# DEBUG: electron-packager,electron-forge:*
# - name: Release
# uses: softprops/action-gh-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# files: |
# **/*.dmg
# **/*.zip
build-windows:
name: Build - Windows
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
runs-on: windows-latest
strategy:
matrix:
os: [windows-latest]
steps:
- name: Checkout code with submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Use node 20
uses: actions/setup-node@v3
with:
node-version: "20.x"
- name: Yarn install
run: yarn install --network-timeout 100000
- name: Add Windows certificate
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/')
id: write_file
uses: timheuer/base64-to-file@v1
with:
fileName: "win-certificate.pfx"
encodedString: ${{ secrets.CERTIFICATE_WINDOWS_PFX }}
- name: LLAMA - Make
id: make_build
run: |
cd llama.cpp && mkdir build && cd build && cmake .. && cmake --build . --config Release && cd ../..
- name: LLAMA - Create directory
id: make_directory
run: |
mkdir -p models/windows/llama
- name: LLAMA - Copy files
id: copy_windows
run: |
cp llama.cpp/build/bin/Release/* models/windows/llama
- name: Remove Mac files
id: remove_mac_miner
run: |
rm -r miner/mac
- name: Make
run: yarn make
env:
WINDOWS_PFX_FILE: ${{ steps.write_file.outputs.filePath }}
WINDOWS_PFX_PASSWORD: ${{ secrets.WINDOWS_PFX_PASSWORD }}
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
**/*Setup.exe
**/*.nupkg