Skip to content

Add folder explorer #23

Add folder explorer

Add folder explorer #23

Workflow file for this run

name: Build & Release
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
version:
name: Compute version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.compute.outputs.version }}
tag: ${{ steps.compute.outputs.tag }}
steps:
- uses: actions/checkout@v4
- name: Compute version
id: compute
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${{ github.event_name }}" = "push" ]; then
YEAR="$(date +'%Y')"
MONTH="$(date +'%m')"
MONTH_SEMVER="$((10#${MONTH}))"
YM="${YEAR}.${MONTH}"
N=""
for i in 1 2 3 4 5; do
LAST="$(gh api "repos/${GITHUB_REPOSITORY}/git/matching-refs/tags/${YM}." --jq '.[].ref' 2>/dev/null || true)"
LAST="$(printf '%s\n' "$LAST" | sed 's|refs/tags/||' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)"
if [ -n "$LAST" ]; then
N="$((${LAST##*.} + 1))"
break
fi
sleep 3
done
if [ -z "$N" ]; then
N="1"
fi
VER="${YEAR}.${MONTH_SEMVER}.${N}"
TAG="${YM}.${N}"
else
VER="$(jq -r '.version' src-tauri/tauri.conf.json)"
TAG="${VER}"
fi
echo "version=${VER}" >> "$GITHUB_OUTPUT"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
build:
name: Build ${{ matrix.name }}
needs: version
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
include:
- name: windows
platform: windows-latest
bundles: msi,nsis
args: --target x86_64-pc-windows-msvc
targets: x86_64-pc-windows-msvc
artifact_paths: |
src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/*.msi
src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe
src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msix/*.msix
- name: macos
platform: macos-latest
bundles: dmg
args: --target universal-apple-darwin
targets: aarch64-apple-darwin,x86_64-apple-darwin
artifact_paths: |
src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg
- name: debian
platform: ubuntu-latest
bundles: deb
args: ''
targets: ''
artifact_paths: |
src-tauri/target/release/bundle/deb/*.deb
- name: fedora
platform: ubuntu-latest
bundles: rpm
args: ''
targets: ''
artifact_paths: |
src-tauri/target/release/bundle/rpm/*.rpm
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies
if: startsWith(matrix.platform, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev build-essential libssl-dev patchelf
- name: Install RPM tooling
if: matrix.name == 'fedora'
run: sudo apt-get install -y rpm
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.targets }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- run: npm ci
- name: Apply version
run: node .github/scripts/bump-version.mjs ${{ needs.version.outputs.version }}
- name: Build bundles
run: npm run tauri:build -- --bundles ${{ matrix.bundles }} ${{ matrix.args }} --ci
- name: Strip language suffix from MSI name
if: matrix.name == 'windows'
shell: bash
run: |
for f in src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/*.msi; do
mv "$f" "$(echo "$f" | sed -E 's/_[A-Za-z]{2}-[A-Za-z]{2}\.msi$/.msi/')"
done
- name: Build MSIX package
if: matrix.name == 'windows'
shell: powershell
env:
MSIX_PFX_BASE64: ${{ secrets.MSIX_PFX_BASE64 }}
MSIX_PFX_PASSWORD: ${{ secrets.MSIX_PFX_PASSWORD }}
MSIX_PUBLISHER_DISPLAY_NAME: ${{ secrets.MSIX_PUBLISHER_DISPLAY_NAME || 'Martzcode' }}
MSIX_IDENTITY_NAME: ${{ secrets.MSIX_IDENTITY_NAME }}
MSIX_PUBLISHER: ${{ secrets.MSIX_PUBLISHER }}
run: .github/scripts/build-msix.ps1
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: markify-${{ matrix.name }}
path: ${{ matrix.artifact_paths }}
if-no-files-found: error
release:
name: Create GitHub release
needs: [version, build]
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: markify-*
merge-multiple: true
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
cd artifacts
gh release create "${{ needs.version.outputs.tag }}" --repo "${GITHUB_REPOSITORY}" --title "Markify ${{ needs.version.outputs.tag }}" --generate-notes $(find . -type f \( -name '*.msi' -o -name '*.exe' -o -name '*.deb' -o -name '*.rpm' -o -name '*.dmg' -o -name '*.msix' \))
gh release view "${{ needs.version.outputs.tag }}" --repo "${GITHUB_REPOSITORY}" --json body --jq .body | sed 's|^\*\*Full Changelog\*\*.*|**Changelog** : https://github.com/'"${GITHUB_REPOSITORY}"'/blob/main/CHANGELOG.md|' > notes.md
gh release edit "${{ needs.version.outputs.tag }}" --repo "${GITHUB_REPOSITORY}" --notes-file notes.md