feat: Remove gemfury workflow and add release jobs #7
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 | |
on: | |
push: | |
branches: [main] | |
paths: | |
- 'sources/sources.json' | |
- '.github/workflows/notion-repackaged.yml' | |
workflow_dispatch: | |
jobs: | |
prepare-sources: | |
name: Prepare sources | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install Ubuntu dependencies | |
run: sudo apt-get install -y jq curl libarchive-tools imagemagick | |
- name: Install npm dependencies | |
run: sudo npm i -g asar | |
- name: Download sources | |
working-directory: scripts | |
run: bash download-sources.sh | |
- name: Prepare sources | |
working-directory: scripts | |
run: bash prepare-sources.sh | |
- name: Compress sources into tar.xz | |
working-directory: work | |
run: tar -cJf src.tar.xz src | |
- name: Save sources as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sources | |
path: work/src.tar.xz | |
build-app: | |
name: Build app | |
needs: [prepare-sources] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
add_electron: [true, false] | |
suffix: ["-electron", ""] | |
exclude: | |
- add_electron: true | |
suffix: "" | |
- add_electron: false | |
suffix: "-electron" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
if: matrix.add_electron | |
with: | |
node-version: 18 | |
- name: Retrieve saved sources | |
uses: actions/download-artifact@v4 | |
with: | |
name: sources | |
- name: Unpack sources archive | |
run: mkdir work && tar -xf src.tar.xz -C work | |
- name: Build app | |
working-directory: scripts | |
env: | |
ADD_ELECTRON: ${{ matrix.add_electron }} | |
run: bash build-app.sh | |
- name: Package app | |
working-directory: scripts | |
env: | |
SUFFIX: ${{ matrix.suffix }} | |
run: bash package-app.sh | |
- name: Calculate checksum | |
run: sha256sum notion-app${{ matrix.suffix }}.tar.xz > notion-app${{ matrix.suffix }}.checksum | |
- name: Upload package and checksum | |
uses: actions/upload-artifact@v4 | |
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v') | |
with: | |
name: notion${{ matrix.suffix }} | |
path: | | |
notion-app${{ matrix.suffix }}.tar.xz | |
notion-app${{ matrix.suffix }}.checksum | |
release: | |
name: Create release | |
needs: [build-app] | |
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get packages from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: notion* | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: | | |
notion-app* | |
cleanup: | |
name: Cleanup artifacts | |
if: always() | |
needs: [release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: geekyeggo/delete-artifact@v4 | |
with: | |
name: | | |
sources | |
notion* |