Skip to content

Merge pull request #308 from StoXProject/StoX4 #544

Merge pull request #308 from StoXProject/StoX4

Merge pull request #308 from StoXProject/StoX4 #544

Workflow file for this run

on:
pull_request:
branches:
- master
- develop
push:
branches:
- master
- develop
jobs:
build:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-13, node_version: 18, architecture: 'x64', pltf: 'mac', in_ext: 'dmg', installer: 'electron-installer-dmg'}
- {os: windows-latest, node_version: 18, architecture: 'x64', pltf: 'win', in_ext: 'msi', installer: 'electron-wix-msi'}
- {os: ubuntu-latest, node_version: 18, architecture: 'x64', pltf: 'linux', in_ext: 'deb', installer: 'electron-installer-debian'}
env:
PLTF: ${{ matrix.config.pltf }}
INSTALL_PKG: ${{ matrix.config.installer }}
name: Node ${{ matrix.config.node_version }} - ${{ matrix.config.architecture }} on ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.config.node_version }}
architecture: ${{ matrix.config.architecture }}
- run: npm install --include=dev
- run: cd frontend
- run: npm install --include=dev
- run: npm install -g @angular/[email protected]
- run: npm install -g [email protected]
- run: cd ..
- run: npm install -g $INSTALL_PKG
- name: Build
if: runner.os != 'Windows'
run: npm run build-${PLTF}
shell: bash
- name: Build for Windows
if: runner.os == 'Windows'
run: npm run build-frontend && npm run package-win && find dist/
shell: bash
- name: Create Code Signing Certificate
if: runner.os == 'Windows'
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.CODE_SIGN_CERT }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
- name: Code Sign (exe)
if: runner.os == 'Windows'
run: |
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.CODE_SIGN_PASS }}' /fd sha256 /tr http://timestamp.sectigo.com /td sha256 dist\StoX-win32-x64\StoX.exe
- name: Set path for candle and light
if: runner.os == 'Windows'
run: echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $GITHUB_PATH
shell: bash
- name: Add msbuild to PATH
if: runner.os == 'Windows'
uses: microsoft/[email protected]
- name: Create installer for Windows
if: runner.os == 'Windows'
run: |
npm install electron-wix-msi
npm run installer-win
#cp dist/installers/*.msi installers/StoXInstaller/res/
#cd installers/StoXInstaller
#MSBuild.exe -p:Configuration=Release
#cd ../..
shell: bash
- name: Code Sign (installers)
if: runner.os == 'Windows'
run: |
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.CODE_SIGN_PASS }}' /fd sha256 /tr http://timestamp.sectigo.com /td sha256 dist\installers\StoX.msi
#& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.CODE_SIGN_PASS }}' /fd sha256 /tr http://timestamp.sectigo.com /td sha256 installers\StoXInstaller\x64\Release\StoXInstaller.exe
- name: Renaming files for upload
env:
EXT: ${{ matrix.config.in_ext }}
run: |
export VERSION=$(node -pe "require('./package.json')['version']")
export FINAL_TAG=${VERSION}
export FULL_TAG=$(node -pe "require('./package.json')['name']")-installer-${PLTF}-${FINAL_TAG}
mv $(ls dist/installers/*${EXT}) dist/installers/${FULL_TAG}.${EXT}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "FINAL_TAG=${FINAL_TAG}" >> $GITHUB_ENV
echo "FULL_TAG=${FULL_TAG}" >> $GITHUB_ENV
if [[ ${FINAL_TAG} == *-* ]];
then
echo "PRERELEASE=true" >> "$GITHUB_ENV"
else
echo "PRERELEASE=false" >> "$GITHUB_ENV"
fi
echo "${PRERELEASE}"
echo "${FINAL_TAG}"
echo "${FULL_TAG}"
shell: bash
#- name: Renaming files for upload (Windows only)
# if: runner.os == 'Windows'
# env:
# FULL_TAG: ${{ env.FULL_TAG }}
# run: |
# mv installers/StoXInstaller/x64/Release/StoXInstaller.exe dist/installers/${FULL_TAG}.exe
# shell: bash
- name: Build Redhat RPM package
if: runner.os == 'Linux'
run: |
npm install -g electron-installer-redhat@latest
electron-installer-redhat --src dist/StoX-linux-x64/ --dest dist/installers/ --arch x86_64
mv $(ls dist/installers/*rpm) dist/installers/${FULL_TAG}.rpm
shell: bash
- run: find dist/installers
shell: bash
#- name: Upload artifacts
# if: github.event_name == 'push' && ( (github.ref == 'refs/heads/master' && ${{ env.PRERELEASE }} = false) || ( github.ref == 'refs/heads/develop' && ${{ env.PRERELEASE }} = true ) )
# uses: actions/upload-artifact@v3
# with:
# name: ${{ env.FULL_TAG }}
# path: dist/installers/${{ env.FULL_TAG }}*
- name: Print stuff
run: |
echo "Tag name from github.ref: ${{ github.ref }}"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
echo "Tag name from github.head_ref: ${{ github.head_ref }}"
shell: bash
- name: Test 0 - push
if: ${{ github.event_name == 'push' }}
run: |
echo "Testing"
shell: bash
- name: Test 1 - github.event.pull_request.merged == true
if: ${{ github.event.pull_request.merged == true }}
run: |
echo "Testing"
shell: bash
- name: Test 2 - github.ref == 'refs/heads/master'
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "Testing"
shell: bash
- name: Test 3 - env.PRERELEASE == false
if: ${{ env.PRERELEASE == false }}
run: |
echo ${{ env.PRERELEASE }}
echo ${{ env.PRERELEASE == false }}
echo ${{ env.PRERELEASE == 'false' }}
shell: bash
- name: Test 3b - env.PRERELEASE == 'false'
if: ${{ env.PRERELEASE == 'false' }}
run: |
echo ${{ env.PRERELEASE }}
echo ${{ env.PRERELEASE == false }}
echo ${{ env.PRERELEASE == 'false' }}
shell: bash
- name: Test 4 - github.ref == 'refs/heads/develop'
if: ${{ github.ref == 'refs/heads/develop' }}
run: |
echo "Testing"
shell: bash
- name: Test 4c - github.ref_name == 'develop'
if: ${{ github.ref_name == 'develop' }}
run: |
echo "Testing"
shell: bash
- name: Test 4d - github.ref_name == 'develop' no brackets
if: github.ref_name == 'develop'
run: |
echo "Testing"
shell: bash
- name: Test 4b - github.ref == 'refs/heads/StoX4'
if: ${{ github.ref == 'refs/heads/StoX4' }}
run: |
echo "StoX4"
shell: bash
- name: Test 5 - env.PRERELEASE == true
if: ${{ env.PRERELEASE == true }}
run: |
echo "Testing"
shell: bash
- name: Test 5b - env.PRERELEASE == 'true'
if: ${{ env.PRERELEASE == 'true' }}
run: |
echo "Testing"
shell: bash
- name: Test 6 - (github.ref == 'refs/heads/master' && env.PRERELEASE == 'false')
if: ${{ (github.ref == 'refs/heads/master' && env.PRERELEASE == 'false') }}
run: |
echo "Testing"
shell: bash
- name: Test 7 - ( github.ref == 'refs/heads/develop' && env.PRERELEASE == 'true' )
if: ${{ ( github.ref == 'refs/heads/develop' && env.PRERELEASE == 'true' ) }}
run: |
echo "Testing"
shell: bash
- name: Test 8 - ( (github.ref == 'refs/heads/master' && env.PRERELEASE == 'false') || ( github.ref == 'refs/heads/develop' && env.PRERELEASE == 'true' ) )
if: ${{ ( (github.ref == 'refs/heads/master' && env.PRERELEASE == 'false') || ( github.ref == 'refs/heads/develop' && env.PRERELEASE == 'true' ) ) }}
run: |
echo "Testing"
shell: bash
- name: Create release and upload files when a pull request is merged (allowUpdates is set to true so that all platforms can be included in the release)
if: ${{ github.event_name == 'push' && ( (github.ref == 'refs/heads/master' && env.PRERELEASE == 'false') || ( github.ref == 'refs/heads/develop' && env.PRERELEASE == 'true' ) ) }}
uses: ncipollo/release-action@v1
with:
allowUpdates: true
tag: v${{ env.FINAL_TAG }}
name: StoX-v${{ env.FINAL_TAG }}
artifacts: dist/installers/${{ env.FULL_TAG }}*
token: ${{ secrets.GITHUB_TOKEN }}