Skip to content

Commit

Permalink
Publish on main
Browse files Browse the repository at this point in the history
  • Loading branch information
irahopkinson committed Sep 27, 2023
1 parent e0775ba commit a8c3b4a
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 8 deletions.
172 changes: 172 additions & 0 deletions .github/workflows/publish-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: Publish

on:
push:
branches: [main]
# DEBUG testing-only - remove this before merge
pull_request:
branches: [main]
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

jobs:
publish:
name: Main on ${{ matrix.os }}, .Net ${{ matrix.dotnet_version }}, node ${{ matrix.node_version }}

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest]
dotnet_version: [7.0.x]
node_version: [18.x]

steps:
- name: Checkout git repo
uses: actions/checkout@v3

- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{matrix.dotnet_version}}

- name: Install Node and NPM
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
cache: npm

- name: Install and build
run: |
npm install
npm run build
- uses: xSAVIKx/artifact-exists-action@v0
id: check_previous_build
with:
name: previous-build

- name: DEBUG artifact-exists-action
if: ${{ !steps.check_previous_build.outputs.exists }}
run: echo does not exists

- name: Download previous build artifacts
if: ${{ steps.check_previous_build.outputs.exists }}
uses: actions/download-artifact@v3
with:
name: previous-build

- name: Set build number
# Retrieve the current build number from a file (if it exists)
id: set_build_number
# Only increment on Linux so all OS's have the same build number
env:
CAN_INCREMENT: ${{ matrix.os != 'macos-latest' }}
run: |
if [[ -f build_number.txt ]]; then
BUILD_NUMBER=$(cat build_number.txt)
else
BUILD_NUMBER=0
fi
if [[ CAN_INCREMENT ]]; then
BUILD_NUMBER=$((BUILD_NUMBER + 1))
fi
echo $BUILD_NUMBER > build_number.txt
echo "build_number=$BUILD_NUMBER" >> $GITHUB_OUTPUT
- name: Update release version
env:
BUILD_NUMBER: ${{ steps.set_build_number.outputs.build_number }}
run: |
if [[ -f current_version.txt ]]; then
PREVIOUS_VERSION=$(cat current_version.txt)
else
PREVIOUS_VERSION=0
fi
cd ./release/app
CURRENT_VERSION=$(node -pe "require('./package.json').version")
echo $CURRENT_VERSION > ../../current_version.txt
if [[ CURRENT_VERSION == PREVIOUS_VERSION ]]; then
BUILD_NUMBER=0
fi
NEW_VERSION="${CURRENT_VERSION}-${BUILD_NUMBER}"
echo "Updating version from ${CURRENT_VERSION} to ${NEW_VERSION}"
npm version $NEW_VERSION
- name: Upload previous build artifacts
uses: actions/upload-artifact@v3
with:
name: previous-build
path: |
build_number.txt
current_version.txt
- name: Install DMG license
if: ${{ matrix.os == 'macos-latest' }}
run: npm install dmg-license

- name: dotnet build - MacOS and Windows
if: ${{ matrix.os == 'macos-latest' }}
run: |
npm run build:data-release:windows
npm run build:data-release:macos
- name: dotnet build - Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: npm run build:data-release:linux

- name: Publish releases - Windows and MacOS
if: ${{ matrix.os == 'macos-latest' }}
# env:
# # These values are used for auto updates signing
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
# CSC_LINK: ${{ secrets.CSC_LINK }}
# CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
run: |
npm exec electron-builder -- build --publish never --win --mac
- name: Publish releases - Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
# no hardlinks so dependencies are copied
USE_HARD_LINKS: false
run: |
npm exec electron-builder -- build --publish never --linux
- name: Upload macOS artifacts
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/upload-artifact@v3
with:
name: app-macos
path: |
./release/build/*.dmg
- name: Upload Windows artifacts
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/upload-artifact@v3
with:
name: app-windows
path: |
./release/build/*.exe
!./release/build/*Setup*.exe
- name: Upload Linux artifacts
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: app-linux
path: |
./release/build/*.AppImage
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

jobs:
publish:
name: Publish on ${{ matrix.os }}, .Net ${{ matrix.dotnet_version }}, and node ${{ matrix.node_version }}
name: Release on ${{ matrix.os }}, .Net ${{ matrix.dotnet_version }}, node ${{ matrix.node_version }}

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

jobs:
test:
name: Test on ${{ matrix.os }}, .Net ${{ matrix.dotnet_version }}, and node ${{ matrix.node_version }}
name: Build on ${{ matrix.os }}, .Net ${{ matrix.dotnet_version }}, node ${{ matrix.node_version }}

runs-on: ${{ matrix.os }}

Expand Down
4 changes: 2 additions & 2 deletions electron-builder.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @see https://www.electron.build/configuration/configuration
*/
{
productName: 'ParanextCore',
appId: 'org.paranext.ParanextCore',
productName: 'Platform.Bible',
appId: 'org.paranext.PlatformBible',
asar: true,
asarUnpack: '**\\*.{node,dll}',
files: ['dist', 'node_modules', 'package.json'],
Expand Down
4 changes: 2 additions & 2 deletions release/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "Paranext",
"name": "platform.bible",
"version": "0.0.2",
"description": "Extensible Bible translation software",
"license": "MIT",
"author": {
"name": "Paranext",
"name": "Platform.Bible",
"url": "https://github.com/paranext/"
},
"main": "./dist/main/main.js",
Expand Down

0 comments on commit a8c3b4a

Please sign in to comment.