-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
247 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: 'FRONTEND build composite action' | ||
description: 'Builds the frontend' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
|
||
- name: Install pnpm | ||
working-directory: ./frontend | ||
shell: bash | ||
run: npm install --global pnpm | ||
|
||
- name: Cache .pnpm-store | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm- | ||
- name: Install dependencies | ||
working-directory: ./frontend | ||
shell: bash | ||
run: pnpm install | ||
|
||
- name: Run FRONTEND pnpm build | ||
working-directory: ./frontend | ||
shell: bash | ||
run: pnpm build |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: [ "releases" ] | ||
tags: | ||
# Regex for a version number such as 0.2.1 | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
tagname: | ||
description: "Tag name for release" | ||
required: false | ||
default: nightly | ||
|
||
jobs: | ||
|
||
# Build the tagname and branch | ||
prepare: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.output.outputs.version }} | ||
branch: ${{ steps.output.outputs.branch }} | ||
steps: | ||
# Manual input on 'workflow_dispatch' | ||
- if: github.event_name == 'workflow_dispatch' | ||
run: | | ||
echo "VERSION=${{ github.event.inputs.tagname }}" | tee -a $GITHUB_ENV | ||
echo "BRANCH=develop" | tee -a $GITHUB_ENV | ||
# Based on tag name when pushed on 'releases' branch. | ||
- if: github.event_name == 'push' | ||
run: | | ||
TAGNAME=${{ github.ref }} | ||
echo "VERSION=${TAGNAME#refs/tags/}" | tee -a $GITHUB_ENV | ||
echo "BRANCH=releases" | tee -a $GITHUB_ENV | ||
- id: output | ||
run: | | ||
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT | ||
echo "branch=$BRANCH" | tee -a $GITHUB_OUTPUT | ||
website: | ||
name: Build FRONTEND | ||
runs-on: windows-latest | ||
needs: prepare | ||
steps: | ||
|
||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.prepare.outputs.branch }} | ||
|
||
- uses: ./.github/actions/build_frontend | ||
|
||
- name: Upload Frontend | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: website | ||
path: ./frontend/dist/ | ||
retention-days: 1 | ||
backend: | ||
name: Cross-platform build BACKEND | ||
runs-on: ${{ matrix.os }} | ||
needs: | ||
- prepare | ||
- website | ||
env: | ||
CARGO_TERM_COLOR: always | ||
CROSS_CONFIG: ./backend/Cross.toml | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
- build: macos | ||
os: macos-latest | ||
target: x86_64-apple-darwin | ||
- build: windows-gnu | ||
os: windows-latest | ||
target: x86_64-pc-windows-gnu | ||
- build: linux | ||
os: ubuntu-latest | ||
target: aarch64-unknown-linux-gnu # raspberryPI OS 64bits | ||
- build: linux | ||
os: ubuntu-latest | ||
target: armv7-unknown-linux-gnueabihf # raspberryPI OS 32bits | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.prepare.outputs.branch }} | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: ${{ matrix.target }} | ||
|
||
- name: Compile BACKEND | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
command: build | ||
args: --verbose --release --manifest-path "./backend/Cargo.toml" --target ${{ matrix.target }} | ||
|
||
- name: Download website | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: website | ||
|
||
- name: Build archive | ||
shell: bash | ||
run: | | ||
binary_name="hermes-studio" | ||
# Build a directory for this version | ||
dirname="$binary_name--${{ needs.prepare.outputs.version }}--${{ matrix.target }}" | ||
mkdir "$dirname" | ||
ls -la | ||
# Move the FRONTEND website into the directory | ||
mv "website" "$dirname" | ||
# Move the release binary (BACKEND) into the directory | ||
if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
mv "./backend/target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" | ||
else | ||
mv "./backend/target/${{ matrix.target }}/release/$binary_name" "$dirname" | ||
fi | ||
# Compress the directory | ||
if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
7z a "$dirname.zip" "$dirname" | ||
echo "ASSET=$dirname.zip" >> $GITHUB_ENV | ||
else | ||
tar -czf "$dirname.tar.gz" "$dirname" | ||
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | ||
fi | ||
- name: Upload the archive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.ASSET }} | ||
path: ${{ env.ASSET }} | ||
retention-days: 1 | ||
publish: | ||
name: Publish release | ||
runs-on: windows-latest | ||
needs: | ||
- prepare | ||
- backend | ||
env: | ||
GH_REPO: ${{ github.repository }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
# Must perform checkout first, since it deletes the target directory | ||
# before running, and would therefore delete the downloaded artifacts | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Retrieve all artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: hermes-studio--* | ||
|
||
- if: needs.prepare.outputs.version == 'nightly' | ||
run: | | ||
{ | ||
echo 'SUBJECT=Hermes-Studio development build' | ||
echo 'PRERELEASE=--prerelease' | ||
} | tee -a $GITHUB_ENV | ||
gh release delete nightly --yes || true | ||
git push origin :nightly || true | ||
- if: needs.prepare.outputs.version != 'nightly' | ||
run: | | ||
{ | ||
echo 'SUBJECT=Hermes-Studio release build' | ||
echo 'PRERELEASE=' | ||
} | tee -a $GITHUB_ENV | ||
- name: Publish release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: hermes-studio--* |
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
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