Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

registry based on env #481

Closed
wants to merge 20 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/on-pull-req.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: ["main"]

jobs:
prettier:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/on-push-server.yaml

This file was deleted.

170 changes: 70 additions & 100 deletions .github/workflows/on-tag.yaml
Original file line number Diff line number Diff line change
@@ -1,112 +1,82 @@
name: On Tag

on:
push:
tags:
- "*"

tags: ["v*"]
jobs:
publish-tauri:
permissions: write-all
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04]

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

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Rust setup
uses: dtolnay/rust-toolchain@stable

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf

- name: Install missing Rust target for universal Mac build
if: matrix.platform == 'macos-latest'
run: rustup target add aarch64-apple-darwin

- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"

- name: Sync node version and setup cache
uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: "npm"

- name: Install frontend dependencies
run: npm install

- name: tag
id: next_tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: version
id: next_version
run: |
tag=${{ steps.next_tag.outputs.tag }}
echo "version=${tag:1}" >> $GITHUB_OUTPUT

- name: Update with latest main branch
run: |
git config --local user.email "$(git log --format='%ae' HEAD^!)"
git config --local user.name "$(git log --format='%an' HEAD^!)"
git config pull.rebase true
git stash
git fetch origin main
git pull origin main
git stash pop || true

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.20.1
id: go

- name: Install dasel
run: |
go install github.com/tomwright/dasel/cmd/dasel@latest

- name: Increment version
run: |
dasel put string -f package.json ".version" "${{ steps.next_version.outputs.version }}"
dasel put string -f src-tauri/tauri.conf.json ".package.version" "${{ steps.next_version.outputs.version }}"
dasel put string -f src-tauri/Cargo.toml ".package.version" "${{ steps.next_version.outputs.version }}"

- name: Build the app
uses: tauri-apps/tauri-action@dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
tagName: ${{ steps.next_tag.outputs.tag }}
releaseName: "PremAI App ${{ steps.next_tag.outputs.tag }}"
releaseBody: "See the assets to download and install this version."
releaseDraft: false
includeDebug: true
updaterJsonKeepUniversal: true
args: ${{matrix.platform == 'ubuntu-20.04' && '--target x86_64-unknown-linux-gnu' || '--target universal-apple-darwin'}}
# Commit package.json, tauri.conf.json and Cargo.toml to master
- name: Commit & Push
run: |
git add .
git commit -m "${{ steps.next_tag.outputs.tag }}"
git push origin HEAD:main


- uses: actions/checkout@v4
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
- name: Install Linux tauri dependencies
if: startsWith(matrix.platform, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install missing Rust target for universal Mac build
if: startsWith(matrix.platform, 'macos')
run: rustup target add aarch64-apple-darwin
- uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: npm
- run: npm install
- name: metadata
id: metadata
run: |
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update with latest main branch
run: |
git config --local user.email "$(git log --format='%ae' HEAD^!)"
git config --local user.name "$(git log --format='%an' HEAD^!)"
git config pull.rebase true
git stash
git fetch origin main
git pull origin main
git stash pop || true
- uses: actions/setup-go@v4
with: {go-version: ^1.20.1}
id: go
- name: Install dasel
run: 'go install github.com/tomwright/dasel/cmd/dasel@latest'
- name: Increment version
run: |
dasel put string -f package.json ".version" "${{ steps.metadata.outputs.version }}"
dasel put string -f src-tauri/tauri.conf.json ".package.version" "${{ steps.metadata.outputs.version }}"
dasel put string -f src-tauri/Cargo.toml ".package.version" "${{ steps.metadata.outputs.version }}"
- name: Build the app
uses: tauri-apps/tauri-action@dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
tagName: ${{ steps.metadata.outputs.tag }}
releaseName: "PremAI App ${{ steps.metadata.outputs.tag }}"
releaseBody: "See the assets to download and install this version."
releaseDraft: false
includeDebug: true
updaterJsonKeepUniversal: true
args: ${{startsWith(matrix.platform, 'ubuntu') && '--target x86_64-unknown-linux-gnu' || '--target universal-apple-darwin'}}
- name: Commit & Push
run: |
# Commit package.json, tauri.conf.json, Cargo.toml
git add .
git commit -m "${{ steps.metadata.outputs.tag }}"
git push origin HEAD:main
52 changes: 52 additions & 0 deletions .github/workflows/on-workflow-dispatch-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 🚀 Docker Image

on:
workflow_dispatch:
inputs:
version:
description: 'Version tag for the Docker image (optional, will use latest Git tag if empty)'
required: false
type: string
tag_as_latest:
description: 'Also tag as latest?'
required: false
default: false
type: boolean

jobs:
push-docker-image:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- uses: actions/checkout@v4
- name: Determine tag
id: tag
run: |
if [ -z "${{ github.event.inputs.version }}" ]; then
git fetch --all --tags
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
else
TAG=${{ github.event.inputs.version }}
fi
echo "VERSION_TAG=$TAG" >> $GITHUB_ENV
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
with:
install: true
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push
run: |
docker buildx build --push \
--file Dockerfile \
--tag ghcr.io/premai-io/prem-app:$VERSION_TAG \
${{ github.event.inputs.tag_as_latest == 'true' && '--tag ghcr.io/premai-io/prem-app:latest' || '' }} \
--platform linux/arm64,linux/amd64 .
shell: /usr/bin/bash -e {0}
env:
DOCKER_CLI_EXPERIMENTAL: enabled

Loading