Skip to content
name: 'Build And Release'
on:
push:
branches:
- release
tags:
- '*'
jobs:
# job 1
build-and-upload:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- windows
- ubuntu
- macos
node:
- 22
steps:
- name: 'Checkout'
uses: actions/[email protected]
- name: 'Setup Node.js "${{ matrix.node }}.x" environment'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
registry-url: https://npm.pkg.github.com/
- name: 'Setup pnpm'
uses: pnpm/action-setup@v4
- name: 'Setup Python environment (Mac) Because of electron-builder install-app-deps requires Python setup tools'
if: matrix.os == 'macos'
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: 'Get package info'
id: package-info
uses: luizfelipelaviola/get-package-info@v1
with:
path: ./packages/mitmproxy
- name: 'Print'
run: |
echo "version = ${{ steps.package-info.outputs.version }}";
echo "github.ref_type = ${{ github.ref_type }}";
echo "github.ref = ${{ github.ref }}";
echo "github.ref_name = ${{ github.ref_name }}";
- name: 'npm -v | pnpm -v | python --version'
run: |
echo "======================================================================";
echo "npm -v";
echo "--------------------";
npm -v;
echo "======================================================================";
echo "pnpm -v";
echo "--------------------";
pnpm -v;
echo "======================================================================";
echo "python --version";
echo "--------------------";
python --version;
- name: 'pnpm install'
run: |
echo "======================================================================";
dir || ls -lah;
echo "======================================================================";
echo "pnpm install";
echo "--------------------";
pnpm install;
- name: 'npm run electron:build'
run: |
echo "======================================================================";
echo "cd packages/gui";
echo "--------------------";
cd packages/gui;
dir || ls -lah;
echo "======================================================================";
echo "npm run electron:build";
echo "--------------------";
npm run electron:build;
echo "======================================================================";
echo "cd dist_electron";
echo "--------------------";
cd dist_electron;
dir || ls -lah;
echo "======================================================================";
echo "cd ../../../";
echo "--------------------";
cd ../../../;
dir || ls -lah;
- name: 'Upload DevSidecar-${{ steps.package-info.outputs.version }}.myself.exe - Windows'
uses: actions/[email protected]
if: ${{ matrix.os == 'windows' }}
with:
path: packages/gui/dist_electron/DevSidecar-${{ steps.package-info.outputs.version }}.myself.exe
name: 'DevSidecar-${{ steps.package-info.outputs.version }}.myself.exe'
if-no-files-found: error
- name: 'Upload DevSidecar-${{ steps.package-info.outputs.version }}.myself.deb - Ubuntu'
uses: actions/[email protected]
if: ${{ matrix.os == 'ubuntu' }}
with:
path: packages/gui/dist_electron/DevSidecar-${{ steps.package-info.outputs.version }}.myself.deb
name: 'DevSidecar-${{ steps.package-info.outputs.version }}.myself.deb'
if-no-files-found: error
- name: 'Upload DevSidecar-${{ steps.package-info.outputs.version }}.myself.AppImage - Ubuntu'
uses: actions/[email protected]
if: ${{ matrix.os == 'ubuntu' }}
with:
path: packages/gui/dist_electron/DevSidecar-${{ steps.package-info.outputs.version }}.myself.AppImage
name: 'DevSidecar-${{ steps.package-info.outputs.version }}.myself.AppImage'
if-no-files-found: error
- name: 'Upload DevSidecar-${{ steps.package-info.outputs.version }}.myself.dmg - Mac'
uses: actions/[email protected]
if: ${{ matrix.os == 'macos' }}
with:
path: packages/gui/dist_electron/DevSidecar-${{ steps.package-info.outputs.version }}.myself.dmg
name: 'DevSidecar-${{ steps.package-info.outputs.version }}.myself.dmg'
if-no-files-found: error
# job 2
download-and-release:
runs-on: ubuntu-latest
needs:
- build-and-upload
steps:
- name: 'Checkout'
uses: actions/[email protected]
- name: 'Get package info'
id: package-info
uses: luizfelipelaviola/get-package-info@v1
with:
path: ./packages/mitmproxy
- name: 'Make "release" dir'
run: mkdir release
# Download artifacts
- name: 'Download DevSidecar-${{ steps.package-info.outputs.version }}.exe - Windows'
uses: actions/[email protected]
with:
name: DevSidecar-${{ steps.package-info.outputs.version }}.exe
path: release
- name: 'Download DevSidecar-${{ steps.package-info.outputs.version }}.deb - Ubuntu'
uses: actions/[email protected]
with:
name: DevSidecar-${{ steps.package-info.outputs.version }}.deb
path: release
- name: 'Download DevSidecar-${{ steps.package-info.outputs.version }}.AppImage - Ubuntu'
uses: actions/[email protected]
with:
name: DevSidecar-${{ steps.package-info.outputs.version }}.AppImage
path: release
- name: 'Download DevSidecar-${{ steps.package-info.outputs.version }}.dmg - Mac'
uses: actions/[email protected]
with:
name: DevSidecar-${{ steps.package-info.outputs.version }}.dmg
path: release
- name: 'Print files from "release" dir'
run: |
ls -lah release;
- name: 'Create a draft release'
uses: wangliang181230/github-action-ghr@master
env:
GITHUB_TOKEN: ${{ github.token }}
GHR_PATH: release/
GHR_TITLE: ${{ github.ref_name }}
GHR_REPLACE: true
GHR_DRAFT: true