Skip to content

build

build #51

Workflow file for this run

name: build
on:
workflow_dispatch:
inputs:
branch:
description: 'The branch to build'
required: true
default: 'main'
tag_version:
description: 'The short version of hoppscotch upstream, eg: use 23.8.1 instead of 2023.8.1'
required: true
default: '23.8.1'
# https://docs.github.com/zh/actions/using-jobs/assigning-permissions-to-jobs
permissions: write-all
env:
APP_NAME: hoppscotch-app
defaults:
run:
shell: bash
jobs:
build-depolyable-static-files:
name: Build depoly files for ${{ github.event.inputs.tag_version }}
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
submodules: true
- name: 'Checkout and push specified tag version of scratch'
run: |
git config --global pull.rebase false
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
cd hoppscotch
git status
git remote -v
git fetch --all --tags
git checkout tags/20${{ github.event.inputs.tag_version }}
git status
cd ..
git add hoppscotch
git commit -m "update hoppscotch to 20${{ github.event.inputs.tag_version }}" || true
# update version in README.md using sed
sed -i "s/[0-9]\+\.[0-9]\+\.[0-9]\+/${{ github.event.inputs.tag_version }}/g" README.md
git add README.md
git commit -m "update README.md" || true
git tag ${{ github.event.inputs.tag_version }} || true
git push
git push --tag
- name: 'Patch ExtensionStrategy.ts'
run: |
echo "original ExtensionStrategy.ts"
cat hoppscotch/packages/hoppscotch-common/src/platform/std/interceptors/extension.ts
cat postwoman_extension_hook_patch.txt >> hoppscotch/packages/hoppscotch-common/src/platform/std/interceptors/extension.ts
echo "patched ExtensionStrategy.ts"
cat hoppscotch/packages/hoppscotch-common/src/platform/std/interceptors/extension.ts
- name: Use Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 18.x
cache: 'npm'
- name: 'Install the root tauri dependences'
run: |
yarn install
- name: 'Install pnpm and dependencies '
run: |
npm install -g pnpm
cp .env.example .env
pnpm install
working-directory: hoppscotch
- name: 'Building'
run: |
pnpm run generate
working-directory: hoppscotch
- name: Prepare build files achive
run: |
ls -lR ./hoppscotch/packages/hoppscotch-selfhost-web/dist/
7z a -tzip ${{env.APP_NAME}}-${{ github.event.inputs.tag_version }}.zip -r ./hoppscotch/packages/hoppscotch-selfhost-web/dist/*
- uses: actions/upload-artifact@v4
with:
name: hoppscotch-dist
path: ${{env.APP_NAME}}-${{ github.event.inputs.tag_version }}.zip
- name: Publish build files achive to release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.event.inputs.tag_version }}
files: ${{env.APP_NAME}}-${{ github.event.inputs.tag_version }}.zip
draft: false
prerelease: false
build-native-executable:
name: 'Build native executable'
needs: [build-depolyable-static-files]
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
runs-on: ${{matrix.os}}
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
submodules: true
- uses: actions/download-artifact@v4
with:
name: hoppscotch-dist
- name: Extract hoppscotch-dist
run: |
rm -rf dist
unzip ${{env.APP_NAME}}-${{ github.event.inputs.tag_version }}.zip -d dist
- name: Display structure of downloaded files
run: ls -l . dist
- name: Use Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 18.x
cache: 'yarn'
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Tauri build
id: tauri-build
uses: liudonghua123/tauri-build-action@main
with:
project_name: ${{env.APP_NAME}}
identifier: com.${{env.APP_NAME}}.app
version: ${{ github.event.inputs.tag_version }}
frontend_dist: ../dist
icon: app-icon.png
- name: Display structure of build files
run: |
ls -la . tauri-build
shell: bash
- name: Publish binary to release
continue-on-error: true
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.event.inputs.tag_version }}
files: tauri-build/*
draft: false
prerelease: false