diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..31bed19 --- /dev/null +++ b/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": ["next/babel"], + "env": { + "production": { + "plugins": [ + ["react-remove-properties", {"properties": ["data-test"]}] + ] + } + } + } \ No newline at end of file diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..78b8951 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,591 @@ +name: Build and Release + +on: + push: + branches: [main] + tags: + - 'v*' + workflow_dispatch: + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: macos-latest + platform: mac + artifact_name: '*.dmg' + artifact_path: 'dist/*.dmg' + - os: ubuntu-latest + platform: linux + artifact_name: '*.AppImage' + artifact_path: 'dist/*.AppImage' + - os: windows-latest + platform: windows + artifact_name: '*.exe' + artifact_path: 'dist/*.exe' + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build Next.js app + run: npm run dist + + - name: Build Electron app (Mac) + if: matrix.platform == 'mac' + run: npx electron-builder --mac --publish never + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Electron app (Linux) + if: matrix.platform == 'linux' + run: npx electron-builder --linux --publish never + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Electron app (Windows) + if: matrix.platform == 'windows' + run: npx electron-builder --windows --publish never + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: markit-${{ matrix.platform }} + path: ${{ matrix.artifact_path }} + retention-days: 30 + + update-downloads-page: + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + + steps: + - uses: actions/checkout@v4 + with: + ref: gh-pages + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Get artifact URLs + id: artifacts + run: | + echo "run_id=${{ github.run_id }}" >> $GITHUB_OUTPUT + echo "repo=${{ github.repository }}" >> $GITHUB_OUTPUT + + - name: Update download links in README + run: | + RUN_ID="${{ github.run_id }}" + REPO="${{ github.repository }}" + + # Update README with artifact download links + cat > README.md << 'EOF' + ### Markit + +  + + > Note : this is still in beta release + + **Markit is a live preview markdown editor it allows html along with markdown.** + + ### Downloads + +
Download for your platform:
+ +Or check Releases for stable versions
+
+ A live preview markdown editor with HTML support
+ Beta +Other platforms:
+ +
+ Download for your platform:
+ +Or check Releases for stable versions
+
+ A live preview markdown editor with HTML support
+ Beta +Other platforms:
+ +
+