chore: bump version to 0.8.0 #89
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'publish' | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
create-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-20.04 | |
outputs: | |
release_id: ${{ steps.create-release.outputs.result }} | |
release_note: ${{ steps.release-note.outputs.release_note }} | |
version: ${{ steps.get-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: get version | |
id: get-version | |
run: | | |
echo "PACKAGE_VERSION=$(node -p "\"${{ github.ref_name }}\".slice(1)")" >> $GITHUB_ENV | |
echo "version=$(node -p "\"${{ github.ref_name }}\".slice(1)")" >> $GITHUB_OUTPUT | |
- name: get release note | |
id: release-note | |
run: | | |
release_note=$(cat ${{ github.workspace }}/RELEASE_NOTE.md) | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "RELEASE_NOTE<<$EOF" >> $GITHUB_ENV | |
echo "$release_note" >> $GITHUB_ENV | |
echo "$EOF" >> $GITHUB_ENV | |
release_note="${release_note//'%'/'%25'}" | |
release_note="${release_note//$'\n'/'%0A'}" | |
release_note="${release_note//$'\r'/'%0D'}" | |
echo "release_note=$release_note" >> $GITHUB_OUTPUT | |
- name: create release | |
id: create-release | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { data } = await github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: `v${process.env.PACKAGE_VERSION}`, | |
name: `ChatWizard v${process.env.PACKAGE_VERSION}`, | |
body: `${process.env.RELEASE_NOTE}`, | |
draft: true, | |
prerelease: false | |
}) | |
return data.id | |
build: | |
needs: create-release | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: macos-latest | |
target: x86_64-apple-darwin | |
- platform: macos-latest | |
target: aarch64-apple-darwin | |
- platform: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
- platform: windows-latest | |
target: x86_64-pc-windows-msvc | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-20.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf | |
- name: install target (macos aarch64 only) | |
if: matrix.target == 'aarch64-apple-darwin' | |
run: | | |
rustup target add aarch64-apple-darwin | |
- name: install frontend dependencies | |
run: npm i -g pnpm && cd web && pnpm install | |
- uses: tauri-apps/tauri-action@dev | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: '' | |
with: | |
projectPath: gui | |
args: --target ${{ matrix.target }} | |
releaseId: ${{ needs.create-release.outputs.release_id }} | |
releaseBody: '${{ needs.create-release.outputs.release_note }}' | |
- name: build cli | |
run: | | |
cd cli | |
cargo build --release --target ${{ matrix.target }} | |
cd .. | |
- name: upload cli asset | |
if: matrix.platform == 'windows-latest' | |
uses: actions/github-script@v6 | |
env: | |
release_id: ${{ needs.create-release.outputs.release_id }} | |
version: ${{ needs.create-release.outputs.version }} | |
target: ${{ matrix.target }} | |
with: | |
script: | | |
const file = require('fs').readFileSync(`target/${process.env.target}/release/chat-wizard-cli.exe`) | |
github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.release_id, | |
name: `chat-wizard-cli_${process.env.target}.exe`, | |
data: file, | |
}) | |
- name: upload cli asset | |
if: matrix.platform != 'windows-latest' | |
uses: actions/github-script@v6 | |
env: | |
release_id: ${{ needs.create-release.outputs.release_id }} | |
version: ${{ needs.create-release.outputs.version }} | |
target: ${{ matrix.target }} | |
with: | |
script: | | |
const file = require('fs').readFileSync(`target/${process.env.target}/release/chat-wizard-cli`) | |
github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.release_id, | |
name: `chat-wizard-cli_${process.env.target}`, | |
data: file, | |
}) | |
- name: build server | |
run: | | |
cd server | |
cargo build --release --target ${{ matrix.target }} | |
cd .. | |
- name: upload server asset | |
if: matrix.platform == 'windows-latest' | |
uses: actions/github-script@v6 | |
env: | |
release_id: ${{ needs.create-release.outputs.release_id }} | |
version: ${{ needs.create-release.outputs.version }} | |
target: ${{ matrix.target }} | |
with: | |
script: | | |
const file = require('fs').readFileSync(`target/${process.env.target}/release/chat-wizard-server.exe`) | |
github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.release_id, | |
name: `chat-wizard-server_${process.env.target}.exe`, | |
data: file, | |
}) | |
- name: upload server asset | |
if: matrix.platform != 'windows-latest' | |
uses: actions/github-script@v6 | |
env: | |
release_id: ${{ needs.create-release.outputs.release_id }} | |
version: ${{ needs.create-release.outputs.version }} | |
target: ${{ matrix.target }} | |
with: | |
script: | | |
const file = require('fs').readFileSync(`target/${process.env.target}/release/chat-wizard-server`) | |
github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.release_id, | |
name: `chat-wizard-server_${process.env.target}`, | |
data: file, | |
}) | |
publish-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-20.04 | |
needs: [create-release, build] | |
steps: | |
- name: publish release | |
id: publish-release | |
uses: actions/github-script@v6 | |
env: | |
release_id: ${{ needs.create-release.outputs.release_id }} | |
with: | |
script: | | |
github.rest.repos.updateRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.release_id, | |
draft: false, | |
prerelease: false | |
}) | |
updater: | |
runs-on: ubuntu-latest | |
needs: [build, publish-release] | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
mkdir -p ${{ github.workspace }}/docs | |
wget -O ${{ github.workspace }}/docs/latest.json https://github.com/lisiur/ChatWizard/releases/download/${{ github.ref_name }}/latest.json | |
- uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
PUBLISH_BRANCH: gh-pages | |
publish_dir: ./docs |