Skip to content

Merge pull request #796 from ahqsoftwares/dependabot/npm_and_yarn/cro… #604

Merge pull request #796 from ahqsoftwares/dependabot/npm_and_yarn/cro…

Merge pull request #796 from ahqsoftwares/dependabot/npm_and_yarn/cro… #604

Workflow file for this run

name: "Build & Release App, Service, Scripts"
on:
push:
branches:
- dev
- release
permissions: write-all
jobs:
create-release:
name: Create a new github release
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.get-u-url.outputs.result }}
release_id: ${{ steps.get-id.outputs.result }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Create Release
id: create-release
uses: actions/github-script@v7
env:
BRANCH: ${{ github.ref_name }}
with:
script: |
const fs = require("fs");
const version = require('./package.json').version;
const alpha = process.env.BRANCH != "release";
const alphaId = Date.now();
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: !alpha ? version : `alpha-${alphaId}`,
name: alpha ? `AHQ Store Alpha v${version}-next-${alphaId}` : `AHQ Store v${version}`,
body: String(fs.readFileSync("./latest.md")),
draft: true,
prerelease: alpha
});
return data
- name: Get Release Id
id: get-id
uses: actions/github-script@v7
env:
data: ${{ steps.create-release.outputs.result }}
with:
result-encoding: string
script: |
let data = process.env.data;
try {
data = JSON.parse(data);
console.log(data.id);
return data.id;
} catch (_) {
console.log(data.id);
return data.id;
}
- name: Get Upload Url
id: get-u-url
uses: actions/github-script@v7
env:
data: ${{ steps.create-release.outputs.result }}
with:
result-encoding: string
script: |
let data = process.env.data;
try {
data = JSON.parse(data);
return data.upload_url;
} catch (_) {
return data.upload_url;
}
publish-cargo:
name: Publish ahqstore-types to cargo
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- name: Publish types to cargo
run: cargo publish
working-directory: src-ahqstore-types
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
continue-on-error: true
publish-types-npm:
name: Publish ahqstore-types to npmjs
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Install wasm-pack
run: npm i -g wasm-pack
working-directory: src-ahqstore-types
- name: Build NPM Binaries
run: wasm-pack build --release -- --features js
working-directory: src-ahqstore-types
- name: Publish NPM Binaries
run: npm publish
working-directory: src-ahqstore-types/pkg
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AHQSTORE_TYPES }}
make-setup:
needs: create-release
name: Make Setup Executable (${{ matrix.os }}-${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
arch: amd64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
arch: amd64
- os: windows-latest
target: aarch64-pc-windows-msvc
arch: arm64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
toolchain: nightly
- name: Install Dependencies (arm v8 only)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
- name: Build Setup
run: cargo build --release --target ${{ matrix.target }}
working-directory: src-setup
- name: Upload Windows Setup
if: matrix.os == 'windows-latest'
uses: ahqstore/upload-release-assets@v60
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./src-setup/target/${{ matrix.target }}/release/ahqstore_setup_amd64.exe
asset_name: ahqstore_setup_win32_${{ matrix.arch }}.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload Linux Setup
if: matrix.os != 'windows-latest'
uses: ahqstore/upload-release-assets@v60
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./src-setup/target/${{ matrix.target }}/release/ahqstore_setup_amd64
asset_name: ahqstore_setup_linux_${{ matrix.arch }}
asset_content_type: application/octet-stream
publish-tauri:
needs: create-release
name: Build Tauri App & Service (x86_64)
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
arch: amd64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
arch: amd64
- os: windows-latest
target: aarch64-pc-windows-msvc
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
run: npm i -g pnpm
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
toolchain: nightly
- name: install dependencies (ubuntu only)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
sudo apt update
sudo apt install libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libayatana-appindicator3-dev librsvg2-dev
- name: Build ahqstore-types locally
run: |
npm i -g wasm-pack
wasm-pack build --release -- --features js
working-directory: src-ahqstore-types
- name: install Vite dependencies and Build React App
run: pnpm install; pnpm build
env:
CI: "false"
- name: Decrypt Key / Load Encryption Key
run: node encryptor.cjs
env:
KEY: ${{ secrets.SSL_ENCRYPT_DATA }}
- name: Build Service
run: cargo build --release
working-directory: src-service
- name: Upload Service (Windows)
if: matrix.os == 'windows-latest'
uses: ahqstore/upload-release-assets@v60
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./src-service/target/release/ahqstore_service.exe
asset_name: ahqstore_service_${{ matrix.arch }}.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Build User Daemon (Windows)
if: matrix.os == 'windows-latest'
run: cargo build --release
working-directory: src-exe-installer
- name: Upload User Daemon (Windows)
if: matrix.os == 'windows-latest'
uses: ahqstore/upload-release-assets@v60
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./src-exe-installer/target/release/ahqstore-user-daemon.exe
asset_name: ahqstore_user_daemon_${{ matrix.arch }}.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload Service (Linux)
if: matrix.os == 'ubuntu-latest'
uses: ahqstore/upload-release-assets@v60
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./src-service/target/release/ahqstore_service
asset_name: ahqstore_service_${{ matrix.arch }}
asset_content_type: application/octet-stream
- name: Build Tauri App
id: tauri-app
uses: tauri-apps/tauri-action@dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI }}
TAURI_KEY_PASSWORD: ${{ secrets.KEYPASS }}
with:
args: --verbose --target ${{ matrix.target }}
releaseId: ${{ needs.create-release.outputs.release_id }}
includeRelease: true
includeUpdaterJson: false
# publish-arm-linux-tauri:
# needs: create-release
# name: Build Tauri App & Service (${{ matrix.deb }})
# continue-on-error: true
# strategy:
# fail-fast: false
# matrix:
# include:
# - img: dietpi:rpi_armv8_bookworm
# cpu: cortex-a72
# deb: arm64
# rpm: aarch64
# appimage: aarch64
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Cache Rust to save lives
# uses: Swatinem/rust-cache@v2
# with:
# prefix-key: cpu-${{ matrix.cpu }}
# workspaces: src-tauri
# cache-on-failure: true
# - name: Setup NodeJS
# uses: actions/setup-node@v4
# - name: Setup Python
# uses: actions/setup-python@v5
# - name: Install
# run: |
# pip install cargo-zigbuild
# rustup toolchain install nightly
# rustup target install aarch64-unknown-linux-gnu
# cd src-ahqstore-types
# npm i -g wasm-pack
# wasm-pack build --release -- --features js
# cd ..
# npm i -g pnpm
# pnpm install
# - name: Build encryptor.cjs
# run: node encryptor.cjs
# env:
# KEY: ${{ secrets.SSL_ENCRYPT_DATA }}
# - name: Build
# run: |
# sudo apt-get update
# sudo apt-get install gcc-aarch64-linux-gnu
# sudo dpkg --add-architecture aarch64
# sudo sed 's/^deb http/deb [arch=aarch64] http/' -i '/etc/apt/apt-mirrors.txt'
# sudo apt-get update -y --allow-releaseinfo-change
# sudo apt-get autoremove -y
# sudo apt-get install -y --no-install-recommends --no-install-suggests curl libwebkit2gtk-4.1-dev:aarch64 build-essential libssl-dev:aarch64 libgtk-3-dev:aarch64 libayatana-appindicator3-dev:aarch64 librsvg2-dev:aarch64 patchelf libfuse2:aarch64 file
# cd src-service
# cargo build --release --target aarch64-unknown-linux-gnu
# cd ..
# export PKG_CONFIG_SYSROOT_DIR=/
# pnpm build
# pnpm tauri build -v --target aarch64-unknown-linux-gnu
# - name: Upload Artifacts
# uses: actions/upload-artifact@v4
# with:
# compression-level: 9
# path: |
# src-service/target/release/
# src-tauri/target/release/
# - name: Upload Service
# uses: ahqstore/upload-release-assets@v60
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-release.outputs.upload_url }}
# asset_name: ahqstore_service_${{ matrix.deb }}
# asset_path: ./src-service/target/release/ahqstore_service
# asset_content_type: application/octet-stream
# - name: Get app version
# run: echo "APP_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
# - name: Upload .deb Bundle
# uses: ahqstore/upload-release-assets@v60
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-release.outputs.upload_url }}
# asset_name: AHQ Store_${{ env.APP_VERSION }}_${{ matrix.deb }}.deb
# asset_path: ./src-tauri/target/release/bundle/deb/AHQ Store_${{ env.APP_VERSION }}_${{ matrix.deb }}.deb
# asset_content_type: application/octet-stream
# - name: Upload .rpm Bundle
# uses: ahqstore/upload-release-assets@v60
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-release.outputs.upload_url }}
# asset_name: AHQ Store_${{ env.APP_VERSION }}_${{ matrix.rpm }}.rpm
# asset_path: ./src-tauri/target/release/bundle/rpm/AHQ Store-${{ env.APP_VERSION }}-1.${{ matrix.rpm }}.rpm
# asset_content_type: application/octet-stream
# - name: Upload .AppImage bundle
# uses: ahqstore/upload-release-assets@v60
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-release.outputs.upload_url }}
# asset_name: AHQ Store_${{ env.APP_VERSION }}_${{ matrix.appimage }}.AppImage
# asset_path: ./src-tauri/target/release/bundle/appimage/AHQ Store_${{ env.APP_VERSION }}_${{ matrix.appimage }}.AppImage
# asset_content_type: application/octet-stream
undraft-release:
needs: [create-release, publish-tauri, make-setup]
name: Publish Release
runs-on: ubuntu-latest
steps:
- name: Undraft Release
uses: actions/github-script@v7
env:
BRANCH: ${{ github.ref_name }}
R_ID: ${{ needs.create-release.outputs.release_id }}
with:
script: |
github.rest.repos.updateRelease({
owner: "ahqsoftwares",
repo: "tauri-ahq-store",
release_id: process.env.R_ID,
draft: false
});