diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml new file mode 100644 index 000000000..007082a83 --- /dev/null +++ b/.github/actions/build-electron/action.yml @@ -0,0 +1,38 @@ +inputs: + os: + description: "One of the supported platforms: macos, linux, windows" + required: true + arch: + description: "The architecture to build for: x64, arm64" + required: true + extension: + description: "Platform specific extension to build: dmg, deb, exe" + required: true +runs: + using: composite + steps: + - name: Set up Python for appdmg to be installed + if: ${{ inputs.os == 'macos' }} + run: brew install python-setuptools + - name: Install dependencies + run: npm ci + - name: Update build info + run: npm run update-build-info + - name: Run electron-forge + run: npm run make-electron -- --arch=${{ inputs.arch }} + - name: Prepare artifacts (Unix) + if: inputs.os != 'windows' + run: | + mkdir -p upload + file=$(find out/make -name '*.zip' -print -quit) + cp "$file" "upload/TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.zip" + file=$(find out/make -name '*.${{ matrix.os.extension }}' -print -quit) + cp "$file" "upload/TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.${{ matrix.os.extension }}" + - name: Prepare artifacts (Windows) + if: inputs.os == 'windows' + run: | + mkdir upload + $file = Get-ChildItem -Path out/make -Filter '*.zip' -Recurse | Select-Object -First 1 + Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.zip" + $file = Get-ChildItem -Path out/make -Filter '*.${{ matrix.os.extension }}' -Recurse | Select-Object -First 1 + Copy-Item -Path $file.FullName -Destination "upload/TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.${{ matrix.os.extension }}" \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8610346aa..7db377eee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,7 @@ jobs: with: node-version: 20 - name: Run the build - uses: ./.github/actions/build + uses: ./.github/actions/build-electron with: os: ${{ matrix.os.name }} arch: ${{ matrix.arch }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 81c21aefa..7cf038607 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -37,7 +37,7 @@ jobs: - name: Update nightly version run: npm run ci-update-nightly-version - name: Run the build - uses: ./.github/actions/build + uses: ./.github/actions/build-electron with: os: ${{ matrix.os.name }} arch: ${{ matrix.arch }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aba519fcd..86b424ee4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: with: node-version: 20 - name: Run the build - uses: ./.github/actions/build + uses: ./.github/actions/build-electron with: os: ${{ matrix.os.name }} arch: ${{ matrix.arch }}