-
Notifications
You must be signed in to change notification settings - Fork 40
140 lines (116 loc) · 4.17 KB
/
on-tag.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: On Tag
on:
push:
tags:
- "*"
jobs:
publish-tauri:
permissions: write-all
strategy:
fail-fast: false
matrix:
platform: [macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
- 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 }}
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: true
includeDebug: true
updaterJsonKeepUniversal: true
args: '--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
push-docker-image:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v3
- name: tag
id: next_tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push prem
run: >-
docker buildx build --push
--file Dockerfile
--tag ghcr.io/premai-io/prem-app:latest
--tag ghcr.io/premai-io/prem-app:${{ steps.next_tag.outputs.tag }}
--platform linux/arm64,linux/amd64 .