Skip to content

Commit

Permalink
ci: update all ci + cd workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
pjdotson committed Nov 12, 2024
1 parent e0371e0 commit bcc41e3
Show file tree
Hide file tree
Showing 17 changed files with 398 additions and 372 deletions.
124 changes: 66 additions & 58 deletions .github/workflows/deploy.console.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
name: Deploy - Console

on:
push:
branches:
- rc
- main
- rc
- sy-1375-run-ci-tests-on-windows-and-macos
pull_request:
branches:
- rc
- main
- rc
workflow_dispatch:

permissions:
contents: write

env:
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}

jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
PURE_VERSION: ${{ steps.version.outputs.PURE_VERSION }}
Expand All @@ -30,7 +36,7 @@ jobs:

- name: Get Version
id: version
working-directory: ./console
working-directory: console
run: |
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
Expand All @@ -47,14 +53,19 @@ jobs:
base: ${{ github.ref }}
filters: |
changed:
- "console/**"
- "pluto/**"
- "client/ts/**"
- "freighter/ts/**"
- "x/ts/**"
- ".github/workflows/deploy.console.yaml"
- .github/workflows/test.console.yaml
- alamos/ts/**
- client/ts/**
- configs/ts/**
- configs/vite/**
- console/**
- drift/**
- pluto/**
- x/media/**
- x/ts/**
create-release:
name: Create Release
runs-on: ubuntu-latest
if: github.event_name == 'push' && needs.setup.outputs.changed == 'true'
needs: setup
Expand All @@ -64,16 +75,18 @@ jobs:
release_id: ${{ steps.create-release.outputs.result }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: package.json
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Create Release
id: create-release
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const { data: releases } = await github.rest.repos.listReleases({
Expand All @@ -92,7 +105,8 @@ jobs:
})
return id
build-tauri:
build:
name: Build (${{ matrix.os }})
needs: setup
if: needs.setup.outputs.changed == 'true'
env:
Expand All @@ -105,13 +119,13 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: MacOS - Import Apple Developer Certificate
- name: Import Apple Developer Certificate
# Only notarize on MacOS and on push events, not on PRs. This prevents excessive
# notarization requests and long CI times on PRs.
if: matrix.platform == 'macos-latest' && github.event_name == 'push'
if: matrix.os == 'macos-latest' && github.event_name == 'push'
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
Expand All @@ -125,9 +139,9 @@ jobs:
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
security find-identity -v -p codesigning build.keychain
- name: MacOS - Verify Certificate
- name: Verify Apple Developer Certificate
# Same as above - only notarize on MacOS and on push events, not on PRs
if: matrix.platform == 'macos-latest' && github.event_name == 'push'
if: matrix.os == 'macos-latest' && github.event_name == 'push'
run: |
CERT_INFO=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application")
echo "Cert info"
Expand All @@ -136,22 +150,21 @@ jobs:
echo "Certificate imported."
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Set up pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
node-version-file: package.json
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Adjust Auto Updater URL for Release Candidate
if: github.event_name == 'push' && github.ref == 'refs/heads/rc'
working-directory: ./console/src-tauri
working-directory: console/src-tauri
run: |
jq '.plugins.updater.endpoints = ["https://raw.githubusercontent.com/synnaxlabs/synnax/rc/console/release-spec.json"]' tauri.conf.json > temp.json
rm tauri.conf.json
Expand All @@ -177,62 +190,58 @@ jobs:
${{ runner.os }}-turbo-
- name: Install Dependencies
run: pnpm i
run: pnpm install

- name: Build Pluto
- name: Build Console Vite
if: needs.setup.outputs.changed == 'true'
run: pnpm build:pluto

- name: Build Drift
if: needs.setup.outputs.changed == 'true'
run: pnpm build:drift
run: pnpm build:console-vite

# We need to build the console separately WITHOUT turbo repo because of strange
# incompatibility issues with rust builds.

- name: Build Console
- name: Build
if: needs.setup.outputs.changed == 'true'
env:
NODE_OPTIONS: "--max_old_space_size=4096"
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }}
working-directory: ./console
working-directory: console
run: pnpm build

- name: Upload MacOS Release Asset
if: github.event_name == 'push' && matrix.platform == 'macos-latest'
if: github.event_name == 'push' && matrix.os == 'macos-latest'
run: |
gh release upload --clobber console-v${{ needs.setup.outputs.VERSION }} ./console/src-tauri/target/release/bundle/macos/Synnax.app.tar.gz
gh release upload --clobber console-v${{ needs.setup.outputs.VERSION }} ./console/src-tauri/target/release/bundle/macos/Synnax.app.tar.gz.sig
gh release upload --clobber console-v${{ needs.setup.outputs.VERSION }} ./console/src-tauri/target/release/bundle/dmg/Synnax_${{ needs.setup.outputs.PURE_VERSION }}_aarch64.dmg
- name: Upload Windows Release Asset
if: github.event_name == 'push' && matrix.platform == 'windows-latest'
if: github.event_name == 'push' && matrix.os == 'windows-latest'
run: |
gh release upload --clobber console-v${{ needs.setup.outputs.VERSION }} ./console/src-tauri/target/release/bundle/msi/Synnax_${{ needs.setup.outputs.PURE_VERSION }}_x64_en-US.msi
gh release upload --clobber console-v${{ needs.setup.outputs.VERSION }} ./console/src-tauri/target/release/bundle/msi/Synnax_${{ needs.setup.outputs.PURE_VERSION }}_x64_en-US.msi.sig
gh release upload --clobber console-v${{ needs.setup.outputs.VERSION }} ./console/src-tauri/target/release/bundle/nsis/Synnax_${{ needs.setup.outputs.PURE_VERSION }}_x64-setup.exe
gh release upload --clobber console-v${{ needs.setup.outputs.VERSION }} ./console/src-tauri/target/release/bundle/nsis/Synnax_${{ needs.setup.outputs.PURE_VERSION }}_x64-setup.exe.sig
publish-release:
publish:
name: Publish
runs-on: ubuntu-latest
if: needs.setup.outputs.changed == 'true' && needs.create-release.outputs.release_id != ''
needs: [create-release, build-tauri, setup]
needs: [setup, create-release, build]
env:
VERSION: ${{ needs.setup.outputs.VERSION }}
PURE_VERSION: ${{ needs.setup.outputs.PURE_VERSION }}
RELEASE_ID: ${{ needs.create-release.outputs.release_id }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Publish Release
id: publish-release
uses: actions/github-script@v6
- name: Publish
uses: actions/github-script@v7
with:
script: |
github.rest.repos.updateRelease({
Expand All @@ -243,14 +252,15 @@ jobs:
prerelease: false,
})
- name: Setup Node
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: package.json
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Add Auto Update JSON File
id: auto-update-json-file
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
release_id: ${{ needs.create-release.outputs.release_id }}
with:
Expand Down Expand Up @@ -295,23 +305,21 @@ jobs:
fs.writeFileSync("console/release-spec.json", JSON.stringify(data, null, 2));
- name: Commit & Push Auto Update JSON File on RC
id: commit-auto-update-json-file-rc
if: github.ref == 'refs/heads/rc'
uses: EndBug/add-and-commit@v9
with:
add: "*"
default_author: github_actor
message: "Auto Update JSON File"
pull: "--commit --no-edit"
push: "origin rc --force"
message: Auto Update JSON File
pull: --commit --no-edit
push: origin rc --force

- name: Commit & Push Auto Update JSON File on Main
id: commit-auto-update-json-file-main
if: github.ref == 'refs/heads/main'
uses: EndBug/add-and-commit@v9
with:
add: "*"
default_author: github_actor
message: "Auto Update JSON File"
pull: "--commit --no-edit"
push: "origin main --force"
message: Auto Update JSON File
pull: --commit --no-edit
push: origin main --force
19 changes: 10 additions & 9 deletions .github/workflows/deploy.docs.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
name: "Docs Search Update"
name: Docs Search Update

on:
push:
branches:
- main
workflow_dispatch:

jobs:
update:
name: "Update Docs Search Index"
name: Update Docs Search Index
runs-on: ubuntu-latest
env:
DOCS_ALGOLIA_APP_ID: ${{ secrets.DOCS_ALGOLIA_APP_ID }}
DOCS_ALGOLIA_WRITE_API_KEY: ${{ secrets.DOCS_ALGOLIA_WRITE_API_KEY }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up PNPM
uses: pnpm/action-setup@v3
with:
version: 9
- name: Set up pnpm
uses: pnpm/action-setup@v4

- name: Set up Node
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: package.json
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install Dependencies
run: pnpm install
Expand Down
Loading

0 comments on commit bcc41e3

Please sign in to comment.