Update Node version to match server #422
This file contains hidden or 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: CI | |
on: push | |
jobs: | |
build: | |
name: Build & test | |
strategy: | |
matrix: | |
include: | |
- platform: linux | |
arch: x64 | |
os: "ubuntu-22.04" | |
- platform: linux | |
arch: arm64 | |
os: "ubuntu-24.04-arm" | |
- platform: windows | |
arch: x64 | |
os: "windows-2019" | |
- platform: mac | |
arch: x64 | |
os: "macos-13" | |
- platform: mac | |
arch: arm64 | |
os: "macos-14" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22.14.0 | |
check-latest: true | |
cache: 'npm' | |
# Due to https://github.com/electron-userland/electron-builder/issues/3901 | |
# Electron-Builder fails to produce deb packages on arm64 without this: | |
- name: Install system FPM to fix ARM64 Linux builds | |
if: matrix.platform == 'linux' && matrix.arch == 'arm64' | |
run: | | |
sudo apt-get update | |
sudo apt-get install ruby ruby-dev build-essential | |
sudo gem install --no-document fpm | |
- run: npm ci | |
# The API key in APPLE_API_KEY is a PEM cert that must be read from disk: | |
- run: echo "$APPLE_API_KEY" > ./apple-api-key.p8 | |
if: startsWith(matrix.os, 'macos-') | |
env: | |
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} | |
- run: npm run build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# For Mac notarization: | |
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} | |
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | |
APPLE_API_KEY: ./apple-api-key.p8 | |
# For Mac signing: | |
CSC_LINK: ${{ secrets.CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
# For Windows signing: | |
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | |
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} | |
# Workaround - see FPM install step above | |
USE_SYSTEM_FPM: ${{ matrix.platform == 'linux' && matrix.arch == 'arm64' }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform }}-${{ matrix.arch }}-distributables | |
path: dist/HttpToolkit-* | |
if-no-files-found: error | |
publish: | |
name: Publish a release | |
runs-on: "ubuntu-22.04" | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
steps: | |
- name: Get all distributables | |
uses: actions/download-artifact@v4 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
prerelease: true | |
- name: Normalize arch names to x64 or arm64 | |
run: | | |
find . -maxdepth 2 -type f -name "*" | while read -r file; do | |
filename=$(basename "$file") | |
newname=$(echo "$filename" | sed -e 's/amd64/x64/g' -e 's/x86_64/x64/g' -e 's/aarch64/arm64/g') | |
if [ "$filename" != "$newname" ]; then | |
mv -v "$file" "$newname" | |
fi | |
done | |
- name: Upload Release Assets | |
id: upload-release-assets | |
uses: dwenegar/upload-release-assets@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} | |
assets_path: ./*/ | |
submit-winget: | |
name: Submit to WinGet repository | |
needs: publish | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
# wingetcreate only runs on Windows | |
runs-on: windows-latest | |
steps: | |
- name: Submit package using wingetcreate | |
run: | | |
$packageVersion = "${{ github.ref }}" -replace 'refs/tags/v', '' | |
$installerUrl = "https://github.com/httptoolkit/httptoolkit-desktop/releases/download/v$packageVersion/HttpToolkit-$packageVersion.exe" | |
# Update package using wingetcreate | |
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe | |
.\wingetcreate.exe update HTTPToolKit.HTTPToolKit ` | |
--version $packageVersion ` | |
--urls "$installerUrl|x64" ` | |
--submit ` | |
--token "${{ secrets.WINGET_GITHUB_TOKEN }}" |