Fix ci? #2
This file contains 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: Notion Repackaged Main | |
on: | |
push: | |
branches: [main] | |
paths: | |
- 'notion-repackaged.sh' | |
- '.github/workflows/notion-repackaged.yml' | |
workflow_dispatch: | |
inputs: {} | |
env: | |
NOTION_REPACKAGED_DEBUG: true | |
jobs: | |
preload-variables: | |
name: Preload variables | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- id: preload-variables | |
name: Load variables and set them as outputs | |
run: | | |
source notion-repackaged.sh | |
echo "{notion_version}={$NOTION_VERSION}" >> $GITHUB_OUTPUT | |
echo "{notion_repackaged_revision}={$NOTION_REPACKAGED_REVISION}" >> $GITHUB_OUTPUT | |
echo "{notion_download_hash}={$NOTION_DOWNLOAD_HASH}" >> $GITHUB_OUTPUT | |
echo "{notion_enhancer_desktop_commit}={$NOTION_ENHANCER_DESKTOP_COMMIT}" >> $GITHUB_OUTPUT | |
NOTION_REPACKAGED_VERSION_REV="${NOTION_VERSION}-${NOTION_REPACKAGED_REVISION}" | |
echo "{notion_repackaged_version_rev}={$NOTION_REPACKAGED_VERSION_REV}" >> $GITHUB_OUTPUT | |
outputs: | |
notion_version: ${{ steps.preload-variables.outputs.notion_version }} | |
notion_repackaged_revision: ${{ steps.preload-variables.outputs.notion_repackaged_revision }} | |
notion_repackaged_version_rev: ${{ steps.preload-variables.outputs.notion_repackaged_version_rev }} | |
notion_download_hash: ${{ steps.preload-variables.outputs.notion_download_hash }} | |
notion_enhancer_desktop_commit: ${{ steps.preload-variables.outputs.notion_enhancer_desktop_commit }} | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
needs: [preload-variables] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: release-drafter/release-drafter@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
version: ${{ needs.preload-variables.outputs.notion_repackaged_version_rev }} | |
tag: v${{ needs.preload-variables.outputs.notion_repackaged_version_rev }} | |
make-vanilla-sources: | |
name: Make vanilla sources | |
runs-on: ubuntu-latest | |
needs: [preload-variables] | |
env: | |
NOTION_VERSION: ${{ needs.preload-variables.outputs.notion_version }} | |
NOTION_REPACKAGED_REVISION: ${{ needs.preload-variables.outputs.notion_repackaged_revision }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: Install moreutils and dos2unix | |
run: sudo apt-get install -y moreutils dos2unix | |
- name: Install asar | |
run: npm install -g asar | |
- name: Download official Windows build | |
env: | |
NOTION_DOWNLOAD_HASH: ${{ needs.preload-variables.outputs.notion_download_hash }} | |
run: scripts/download-exe.sh | |
- name: Extract sources from Windows Build | |
run: scripts/extract-src.sh | |
- name: Zip sources dir with 7z | |
working-directory: build | |
run: 7z a vanilla-src.zip vanilla-src | |
- name: Save vanilla sources as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: vanilla-sources | |
path: build/vanilla-src.zip | |
make-enhanced-sources: | |
name: Make enhanced sources | |
needs: [make-vanilla-sources, preload-variables] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install icnsutils, moreutils, and dos2unix | |
run: sudo apt-get install -y icnsutils moreutils dos2unix | |
- name: Force to use HTTPS instead of SSH | |
run: git config --global url."https://github.com/".insteadOf "[email protected]:" | |
- name: Retrieve saved vanilla sources | |
uses: actions/download-artifact@v2 | |
with: | |
name: vanilla-sources | |
path: build/vanilla-src.zip | |
- name: Unzip sources with 7z | |
working-directory: build | |
run: 7z x vanilla-src.zip | |
- name: Enhance extracted sources | |
env: | |
NOTION_ENHANCER_DESKTOP_COMMIT: ${{ needs.preload-variables.outputs.notion_enhancer_desktop_commit }} | |
run: scripts/enhance-src.sh | |
- name: Zip sources dir with 7z | |
working-directory: build | |
run: 7z a enhanced-src.zip enhanced-src | |
- name: Save enhanced sources as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: enhanced-sources | |
path: build/enhanced-src.zip | |
build-app: | |
name: Build app | |
needs: [make-vanilla-sources, make-enhanced-sources, preload-variables, create-release] | |
runs-on: ${{ matrix.os }} | |
env: | |
NOTION_VERSION: ${{ needs.preload-variables.outputs.notion_version }} | |
NOTION_REPACKAGED_REVISION: ${{ needs.preload-variables.outputs.notion_repackaged_revision }} | |
strategy: | |
matrix: | |
target: [windows, linux, macos] | |
edition: [vanilla, enhanced] | |
include: | |
- target: windows | |
os: windows-latest | |
- target: linux | |
os: ubuntu-latest | |
- target: macos | |
os: macos-latest | |
exclude: | |
- target: windows | |
edition: vanilla | |
- target: macos | |
edition: vanilla | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: Retrieve saved sources | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ matrix.edition }}-sources | |
path: sources.zip | |
- name: Unzip sources with 7z | |
run: 7z x sources.zip | |
- name: Install Linux build dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install --no-install-recommends -y libopenjp2-tools rpm libarchive-tools | |
- name: Install dependencies | |
working-directory: ${{ matrix.edition }}-src | |
run: npm install | |
- name: Run patch-package | |
working-directory: ${{ matrix.edition }}-src | |
run: npx patch-package | |
- name: Install electron and electron-builder | |
working-directory: ${{ matrix.edition }}-src | |
run: npm install electron@25 electron-builder --save-dev | |
- name: Run electron-builder | |
working-directory: ${{ matrix.edition }}-src | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NOTION_REPACKAGED_EDITION: ${{ matrix.edition }} | |
run: npx electron-builder --${{ matrix.target }} -c ../electron-builder.js | |
- name: Print packages md5 checksums | |
working-directory: ${{ matrix.edition }}-src | |
run: find ./dist/ -maxdepth 1 -type f -exec openssl md5 {} + | |
shell: bash | |
cleanup: | |
name: Cleanup artifacts | |
if: always() | |
needs: [build-app] | |
strategy: | |
matrix: | |
edition: [vanilla, enhanced] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: '${{ matrix.edition }}-sources' |