nightly builds

This commit is contained in:
Nikita Galaiko 2023-07-12 16:06:10 +02:00
parent dd16428451
commit 556db1290d
9 changed files with 90 additions and 11 deletions

View File

@ -1,3 +1,4 @@
PUBLIC_API_BASE_URL=https://test.app.gitbutler.com/
PUBLIC_POSTHOG_API_KEY=phc_t7VDC9pQELnYep9IiDTxrq2HLseY5wyT7pn0EpHM7rr
PUBLIC_CHAIN_API=https://data-test.gitbutler.com/chain/
PUBLIC_SENTRY_ENVIRONMENT=development

4
.env.nightly Normal file
View File

@ -0,0 +1,4 @@
PUBLIC_API_BASE_URL=https://app.gitbutler.com/
PUBLIC_POSTHOG_API_KEY=phc_yJx46mXv6kA5KTuM2eEQ6IwNTgl5YW3feKV5gi7mfGG
PUBLIC_CHAIN_API=https://data.gitbutler.com/chain/
PUBLIC_SENTRY_ENVIRONMENT=nightly

View File

@ -1,3 +1,4 @@
PUBLIC_API_BASE_URL=https://app.gitbutler.com/
PUBLIC_POSTHOG_API_KEY=phc_yJx46mXv6kA5KTuM2eEQ6IwNTgl5YW3feKV5gi7mfGG
PUBLIC_CHAIN_API=https://data.gitbutler.com/chain/
PUBLIC_SENTRY_ENVIRONMENT=production

13
.github/workflows/nightly.yaml vendored Normal file
View File

@ -0,0 +1,13 @@
name: "Nightly build"
on:
workflow_dispatch: {}
schedule:
# every day at 3am
- cron: '0 3 * * *'
jobs:
noop:
runs-on: ubuntu-latest
steps:
run: echo "Success!"

View File

@ -1,7 +1,19 @@
name: "Publish"
on:
workflow_run:
workflows: ["Nightly build"]
types:
- completed
workflow_dispatch:
inputs:
channel:
type: choice
required: true
description: channel
options:
- release
- nightly
bump:
type: choice
required: true
@ -67,9 +79,19 @@ jobs:
with:
workspaces: src-tauri
- name: Set release channel = 'nightly'
if: ${{ !!github.event.workflow_run }}
run: |
echo "channel=nightly" >> $GITHUB_ENV
- name: Use input release channel
if: ${{ !!github.event.workflow_dispatch }}
run: |
echo "channel=${{ github.event.inputs.channel }}" >> $GITHUB_ENV
- name: Set env variable with version
run: |
CURRENT_VERSION="$(curl --silent "https://app.gitbutler.com/releases" | jq -r '.version')"
CURRENT_VERSION="$(curl --silent "https://app.gitbutler.com/releases/${{ env.channel }}" | jq -r '.version')"
NEXT_VERSION=$(./scripts/next.sh "${CURRENT_VERSION}" "${{ github.event.inputs.bump }}")
echo "version=$NEXT_VERSION" >> $GITHUB_ENV
@ -77,6 +99,7 @@ jobs:
run: |
./scripts/release.sh \
--sign \
--channel "${{ env.channel }}" \
--dist "./release" \
--version "${{ env.version }}" \
--tauri-private-key "${{ secrets.TAURI_PRIVATE_KEY }}" \
@ -95,7 +118,7 @@ jobs:
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: "releases.gitbutler.com"
source_dir: "release/"
destination_dir: "releases/${{ env.version }}-${{ github.run_number }}"
destination_dir: "releases/${{ env.channel }}/${{ env.version }}-${{ github.run_number }}"
# tell our server to update with the version number
- name: Tell our server to update
@ -105,4 +128,4 @@ jobs:
--request POST \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: ${{ secrets.BOT_AUTH_TOKEN }}' \
--data '{"version":"${{ env.version }}-${{ github.run_number }}","sha":"${{ github.sha }}"}'
--data '{"channel":"${{ env.channel }}","version":"${{ env.version }}-${{ github.run_number }}","sha":"${{ github.sha }}"}'

View File

@ -6,6 +6,7 @@ set -o pipefail
PWD="$(dirname $(readlink -f -- $0))"
CHANNEL=""
DO_SIGN="false"
DO_BUNDLE_UPDATE="false"
TAURI_PRIVATE_KEY=""
@ -33,6 +34,7 @@ function help() {
echo " --apple-id the apple id to use for signing." 1>&$to
echo " --apple-password the password for the apple id." 1>&$to
echo " --sign if set, will sign the app." 1>&$to
echo " --channel the channel to use for the release (release | nightly)." 1>&$to
echo " --help display this message." 1>&$to
}
@ -137,6 +139,11 @@ while [[ $# -gt 0 ]]; do
DO_SIGN="true"
shift
;;
--channel)
CHANNEL="$2"
shift
shift
;;
*)
error "unknown flag $1"
;;
@ -148,6 +155,10 @@ done
[ -z "$TAURI_PRIVATE_KEY" ] && error "--tauri-private-key is not set"
[ -z "$TAURI_KEY_PASSWORD" ] && error "--tauri-key-password is not set"
if [ "$CHANNEL" != "release" ] && [ "$CHANNEL" != "nightly" ]; then
error "--channel must be either 'release' or 'nightly'"
fi
export TAURI_PRIVATE_KEY="$TAURI_PRIVATE_KEY"
export TAURI_KEY_PASSWORD="$TAURI_KEY_PASSWORD"
@ -166,6 +177,7 @@ if [ "$DO_SIGN" = "true" ]; then
fi
info "building:"
info " channel: $CHANNEL"
info " version: $VERSION"
info " os: $OS"
info " arch: $ARCH"
@ -174,13 +186,15 @@ info " dist: $DIST"
TMP_DIR="$(mktemp -d)"
trap "rm -rf '$TMP_DIR'" exit
CONFIG_PATH=$(readlink -f "$PWD/../src-tauri/tauri.conf.$CHANNEL.json")
# update the version in the tauri release config
jq '.package.version="'"$VERSION"'"' "$PWD/../src-tauri/tauri.conf.release.json" >"$TMP_DIR/tauri.conf.json"
jq '.package.version="'"$VERSION"'"' "$CONFIG_PATH" >"$TMP_DIR/tauri.conf.json"
# build the app with release config
SENTRY_RELEASE="$VERSION" tauri build --config "$TMP_DIR/tauri.conf.json"
BUNDLE_DIR="$PWD/../src-tauri/target/release/bundle"
BUNDLE_DIR=$(readlink -f "$PWD/../src-tauri/target/release/bundle")
MACOS_DMG="$(find "$BUNDLE_DIR/dmg" -depth 1 -type f -name "*.dmg")"
MACOS_UPDATER="$(find "$BUNDLE_DIR/macos" -depth 1 -type f -name "*.tar.gz")"
MACOS_UPDATER_SIG="$(find "$BUNDLE_DIR/macos" -depth 1 -type f -name "*.tar.gz.sig")"

View File

@ -0,0 +1,27 @@
{
"package": {
"productName": "GitButler Nightly"
},
"tauri": {
"bundle": {
"identifier": "com.gitbutler.app.nightly"
},
"security": {
"csp": {
"default-src": "'self'",
"img-src": "'self' asset: https://asset.localhost",
"connect-src": "'self' https://eu.posthog.com https://app.gitbutler.com https://o4504644069687296.ingest.sentry.io ws://localhost:7703",
"script-src": "'self' https://eu.posthog.com",
"style-src": "'self' 'unsafe-inline'"
}
},
"updater": {
"active": true,
"dialog": true,
"endpoints": [
"https://app.gitbutler.com/releases/nightly/{{target}}-{{arch}}/{{current_version}}"
],
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDYwNTc2RDhBM0U0MjM4RUIKUldUck9FSStpbTFYWUE5UkJ3eXhuekZOL2V2RnpKaFUxbGJRNzBMVmF5V0gzV1JvN3hRblJMRDIK"
}
}
}

View File

@ -6,11 +6,6 @@
"bundle": {
"identifier": "com.gitbutler.app"
},
"allowlist": {
"shell": {
"open": true
}
},
"security": {
"csp": {
"default-src": "'self'",

View File

@ -1,11 +1,12 @@
import { handleErrorWithSentry, init } from '@sentry/sveltekit';
import type { NavigationEvent } from '@sveltejs/kit';
import { dev } from '$app/environment';
import { PUBLIC_SENTRY_ENVIRONMENT } from '$env/static/public';
init({
enabled: !dev,
dsn: 'https://9d407634d26b4d30b6a42d57a136d255@o4504644069687296.ingest.sentry.io/4504649768108032',
environment: dev ? 'development' : 'production',
environment: PUBLIC_SENTRY_ENVIRONMENT,
tracesSampleRate: 1.0
});