Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions .github/workflows/auto-tag.yml

This file was deleted.

164 changes: 164 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Build & Publish

on:
push:
tags:
- 'v*'

permissions:
contents: write

env:
NODE_VERSION: '22'
ELECTRON_CACHE: ~/.cache/electron
ELECTRON_BUILDER_CACHE: ~/.cache/electron-builder

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
platform: mac
- os: windows-latest
platform: win
- os: ubuntu-latest
platform: linux

runs-on: ${{ matrix.os }}

steps:
- name: Checkout tag
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'

- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: pnpm-${{ matrix.platform }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-${{ matrix.platform }}-

- name: Cache Electron downloads
uses: actions/cache@v4
with:
path: |
${{ env.ELECTRON_CACHE }}
${{ env.ELECTRON_BUILDER_CACHE }}
key: electron-${{ matrix.platform }}-${{ hashFiles('apps/desktop/package.json') }}
restore-keys: electron-${{ matrix.platform }}-

- name: Force HTTPS for GitHub git dependencies
shell: bash
run: git config --global 'url.https://github.com/.insteadOf' 'git@github.com:'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build packages
run: pnpm build

- name: Build Electron app
working-directory: apps/desktop
run: pnpm build

- name: Build distributables (macOS)
if: matrix.platform == 'mac'
working-directory: apps/desktop
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: pnpm dist:mac --publish always

- name: Build distributables (Windows)
if: matrix.platform == 'win'
working-directory: apps/desktop
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: pnpm dist:win --publish always

- name: Build distributables (Linux)
if: matrix.platform == 'linux'
working-directory: apps/desktop
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: pnpm dist:linux --publish always

- name: Upload artifacts (backup)
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-build
path: |
apps/desktop/release/*.dmg
apps/desktop/release/*.zip
apps/desktop/release/*.exe
apps/desktop/release/*.AppImage
apps/desktop/release/*.deb
apps/desktop/release/latest*.yml
apps/desktop/release/*.blockmap
if-no-files-found: ignore
retention-days: 30

publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Publish GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
run: gh release edit "$TAG_NAME" --draft=false --repo "${{ github.repository }}"

tweet:
needs: publish
runs-on: ubuntu-latest
if: "!contains(github.ref_name, 'beta')"
continue-on-error: true
steps:
- name: Extract version
id: version
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"

- name: Post tweet
uses: dart-actions/tweet@v1
with:
consumer-key: ${{ secrets.TWITTER_API_KEY }}
consumer-secret: ${{ secrets.TWITTER_API_SECRET }}
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.TWITTER_ACCESS_SECRET }}
text: |
Readied ${{ steps.version.outputs.tag }} is out!

https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.tag }}
#readied #markdown #devtools

sync-develop:
needs: publish
runs-on: ubuntu-latest
steps:
- name: Create sync PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--base develop \
--head main \
--title "chore: sync release ${{ github.ref_name }} back to develop" \
--body "Auto sync of release commit and changelog." \
--repo "${{ github.repository }}"
Loading
Loading