Compare commits
96 Commits
v0.0.39
...
369eede485
Author | SHA1 | Date | |
---|---|---|---|
369eede485 | |||
b8a7e5ff0c | |||
de05c04a36 | |||
a89d6e5480 | |||
3a33275185 | |||
238860053d | |||
21debac8ad | |||
632648ca8c | |||
c86eb849f3 | |||
3412be9484 | |||
5bb6311fea | |||
8cc54fb466 | |||
6f87b1f4da | |||
99379efa15 | |||
534a6e2bf9 | |||
c01fc59271 | |||
1030363896 | |||
633629ca91 | |||
26eb08d37c | |||
156c804d1a | |||
78ece703ef | |||
185649671f | |||
25da3aea19 | |||
a0206c3287 | |||
bd0a8e223e | |||
eeca47790b | |||
1db7805031 | |||
66630d84fb | |||
44b495a282 | |||
dfe30ecade | |||
f95156febb | |||
8896100e3d | |||
1ed8493bb7 | |||
3e61e45655 | |||
e10c14b3e0 | |||
77ef734baa | |||
b3584332c5 | |||
6fa6704f1c | |||
26c678a3e5 | |||
3a142ad595 | |||
1c317b3154 | |||
ade88cf810 | |||
f4ae33c00d | |||
13c1eaf77f | |||
f475f6e64d | |||
a93ad92ab9 | |||
23c807d508 | |||
3d01527e92 | |||
b19fdce370 | |||
a69e2ffa40 | |||
35df911072 | |||
bd24a3c84b | |||
0cdbfeaca9 | |||
afa88b6274 | |||
89651cdbf6 | |||
dabb473e0f | |||
5a3c4e7369 | |||
f7070590b8 | |||
e6b378c170 | |||
fe05a64eb0 | |||
7b3d66886d | |||
bc74994ac4 | |||
e20a67f7a4 | |||
01e2f3eca3 | |||
95a2a00cec | |||
b6058aa434 | |||
0adbbc3f06 | |||
46058ae5d6 | |||
94b367c2fb | |||
548efa254c | |||
68166c8d3a | |||
3a5fa69bf6 | |||
23be247cdb | |||
9a204d3808 | |||
00e36b6c77 | |||
3b34d50120 | |||
13b652d425 | |||
3bdef16173 | |||
968378e8bb | |||
6767df7f91 | |||
f9245c4145 | |||
e20156a2de | |||
4f9dee1e27 | |||
fe8a1376fa | |||
7619be6d11 | |||
1062595d7f | |||
d829c1efb2 | |||
a1f22433a0 | |||
43fc67ded6 | |||
8e7781a346 | |||
68dd90048f | |||
7bf54bbd8c | |||
9fa5818860 | |||
77859b3d94 | |||
9e26479f67 | |||
000797f930 |
@ -1,14 +0,0 @@
|
|||||||
.env
|
|
||||||
/docker-compose.*
|
|
||||||
/result*
|
|
||||||
/.direnv/
|
|
||||||
/build/
|
|
||||||
|
|
||||||
# Client
|
|
||||||
/client/node_modules/
|
|
||||||
/client/.svelte-kit/
|
|
||||||
|
|
||||||
# Server
|
|
||||||
/server/client/
|
|
||||||
/server/tmp/
|
|
||||||
/server/build/
|
|
@ -5,29 +5,62 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, reopened, edited, auto_merge_enabled]
|
types: [opened, reopened, edited, auto_merge_enabled, synchronize]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
name: check
|
name: check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: |
|
if: |
|
||||||
contains(gitea.event.head_commit.message, 'bump:') == false &&
|
contains(github.event.head_commit.message, 'bump:') == false &&
|
||||||
contains(gitea.event.head_commit.message, 'Merge pull request') == false
|
contains(github.event.head_commit.message, 'Merge pull request') == false
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install nix
|
||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
|
||||||
- name: Use Cachix
|
- name: Use cachix
|
||||||
uses: cachix/cachix-action@v16
|
uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
name: trevstack
|
name: trevstack
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
- name: Check
|
- run: nix flake check --accept-flake-config
|
||||||
run: nix flake check
|
|
||||||
|
push:
|
||||||
|
name: push
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: check
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: "0"
|
||||||
|
|
||||||
|
# https://github.com/actions/checkout/issues/13
|
||||||
|
- name: Push to Production
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git push origin main:production
|
||||||
|
|
||||||
|
update:
|
||||||
|
name: update
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ contains(github.event.head_commit.message, 'Merge pull request') }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: "0"
|
||||||
|
|
||||||
|
# https://github.com/actions/checkout/issues/13
|
||||||
|
- name: Push to Production
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git push origin main:production
|
||||||
|
@ -9,43 +9,31 @@ jobs:
|
|||||||
check:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
- uses: ./.actions/init
|
||||||
|
|
||||||
- name: Install Nix
|
|
||||||
uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
token: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
- name: Use Cachix
|
- run: nix flake check
|
||||||
uses: cachix/cachix-action@v16
|
|
||||||
with:
|
|
||||||
name: trevstack
|
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
|
||||||
|
|
||||||
- name: Check
|
|
||||||
run: nix flake check
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check
|
needs: check
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install nix
|
||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
|
||||||
- name: Use Cachix
|
- name: Use cachix
|
||||||
uses: cachix/cachix-action@v16
|
uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
name: trevstack
|
name: trevstack
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
- name: Build
|
- run: >
|
||||||
run: >
|
|
||||||
nix build
|
nix build
|
||||||
.#trevstack-linux-amd64
|
.#trevstack-linux-amd64
|
||||||
.#trevstack-linux-arm64
|
.#trevstack-linux-arm64
|
||||||
@ -54,52 +42,85 @@ jobs:
|
|||||||
.#trevstack-darwin-amd64
|
.#trevstack-darwin-amd64
|
||||||
.#trevstack-darwin-arm64
|
.#trevstack-darwin-arm64
|
||||||
|
|
||||||
- name: Release
|
- uses: akkuman/gitea-release-action@v1
|
||||||
uses: akkuman/gitea-release-action@v1
|
|
||||||
with:
|
with:
|
||||||
files: |-
|
files: |-
|
||||||
result*/bin/*
|
result*/bin/*
|
||||||
|
|
||||||
# https://docs.docker.com/build/ci/github-actions/manage-tags-labels/
|
|
||||||
package:
|
package:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: release # Wait for binary cache to propagate
|
needs: release
|
||||||
steps:
|
steps:
|
||||||
- name: Get domain
|
- uses: actions/checkout@v4
|
||||||
id: get_domain
|
|
||||||
run: |
|
|
||||||
DOMAIN=$(basename ${{ gitea.server_url }})
|
|
||||||
echo $DOMAIN
|
|
||||||
echo "domain=$DOMAIN" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Install nix
|
||||||
id: meta
|
uses: cachix/install-nix-action@v31
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
with:
|
||||||
# list of Docker images to use as base name for tags
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
images: |
|
|
||||||
${{ steps.get_domain.outputs.domain }}/${{ gitea.repository }}
|
|
||||||
# generate Docker tags based on the following events/attributes
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
|
|
||||||
- name: Login to Gitea Container Registry
|
- name: Use cachix
|
||||||
uses: docker/login-action@v3
|
uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
registry: ${{ gitea.server_url }}
|
name: trevstack
|
||||||
username: ${{ gitea.actor }}
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
|
- uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ github.server_url }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.PAT }}
|
password: ${{ secrets.PAT }}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Build & load images
|
||||||
uses: docker/setup-qemu-action@v3
|
run: |
|
||||||
|
nix build .#trevstack-linux-amd64-image && ./result | docker load
|
||||||
|
nix build .#trevstack-linux-arm64-image && ./result | docker load
|
||||||
|
nix build .#trevstack-linux-arm-image && ./result | docker load
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set env
|
||||||
uses: docker/setup-buildx-action@v3
|
shell: bash
|
||||||
|
run: |
|
||||||
|
REGISTRY=$(basename ${{ github.server_url }})
|
||||||
|
|
||||||
- name: Build and push
|
NR=${{ github.repository }}
|
||||||
uses: docker/build-push-action@v6
|
NAMESPACE="${NR%%/*}"
|
||||||
with:
|
REPOSITORY="${NR##*/}"
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
TAG=${{ github.ref_name }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
VERSION=${TAG#v}
|
||||||
|
|
||||||
|
echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV
|
||||||
|
echo "NAMESPACE=${NAMESPACE}" >> $GITHUB_ENV
|
||||||
|
echo "REPOSITORY=${REPOSITORY}" >> $GITHUB_ENV
|
||||||
|
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Push images
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
docker image tag $REPOSITORY:$VERSION-amd64 $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64
|
||||||
|
docker push $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64
|
||||||
|
|
||||||
|
docker image tag $REPOSITORY:$VERSION-arm64 $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64
|
||||||
|
docker push $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64
|
||||||
|
|
||||||
|
docker image tag $REPOSITORY:$VERSION-arm $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm
|
||||||
|
docker push $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm
|
||||||
|
|
||||||
|
- name: Push manifest
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
docker manifest create $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64 \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64 \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64 --arch amd64
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64 --arch arm64
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm --arch arm
|
||||||
|
docker manifest push $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION
|
||||||
|
|
||||||
|
docker manifest create $REGISTRY/$NAMESPACE/$REPOSITORY:latest \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64 \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64 \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:latest $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64 --arch amd64
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:latest $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64 --arch arm64
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:latest $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm --arch arm
|
||||||
|
@ -9,54 +9,53 @@ jobs:
|
|||||||
update:
|
update:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install nix
|
||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
|
||||||
- name: Use Cachix
|
- name: Use cachix
|
||||||
uses: cachix/cachix-action@v16
|
uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
name: trevstack
|
name: trevstack
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
# https://github.com/actions/checkout/issues/13
|
# https://github.com/actions/checkout/issues/13
|
||||||
- name: Set Git Config
|
- name: Set git config
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
git checkout -B update
|
git checkout -B update
|
||||||
|
|
||||||
- name: Update
|
- run: nix run .#update
|
||||||
run: nix run .#update
|
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create pull request
|
||||||
env:
|
env:
|
||||||
PAT: ${{ secrets.PAT }}
|
PAT: ${{ secrets.PAT }}
|
||||||
run: |
|
run: |
|
||||||
|
git push origin update --force
|
||||||
|
|
||||||
URL="${{ gitea.server_url }}"
|
URL="${{ gitea.server_url }}"
|
||||||
REPO_OWNER_SLASH_NAME="${{ gitea.repository }}"
|
REPO_OWNER_SLASH_NAME="${{ gitea.repository }}"
|
||||||
|
|
||||||
if ! git ls-remote --exit-code origin update; then
|
PRS=$(curl -s -X GET -H "Authorization: token $PAT" \
|
||||||
git push origin update --force
|
-H "Content-Type: application/json" \
|
||||||
|
"$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls?state=open")
|
||||||
|
PR_UPDATE=$(echo "$PRS" | jq -cr '.[] | select( .title | contains("update") )')
|
||||||
|
|
||||||
PR_RESPONSE=$(curl -s -X POST -H "Authorization: token $PAT" \
|
if [ -z "$PR_UPDATE" ]; then
|
||||||
|
echo "Creating pull request"
|
||||||
|
|
||||||
|
PR_CREATE=$(curl -s -X POST -H "Authorization: token $PAT" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"title":"update","body":"automatic update","head":"update","base":"main"}' \
|
-d '{"title":"update","body":"automatic update","head":"update","base":"main"}' \
|
||||||
"https://$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls")
|
"$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls")
|
||||||
|
PR_NUMBER=$(echo "$PR_CREATE" | jq -r '.number')
|
||||||
PR_NUMBER=$(echo "$PR_RESPONSE" | jq -r '.number')
|
|
||||||
|
|
||||||
curl -s -X POST -H "Authorization: token $PAT" \
|
curl -s -X POST -H "Authorization: token $PAT" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"Do":"merge","merge_when_checks_succeed":true,"delete_branch_after_merge":true}' \
|
-d '{"Do":"merge","merge_when_checks_succeed":true,"delete_branch_after_merge":true}' \
|
||||||
"https://$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls/$PR_NUMBER/merge"
|
"$URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls/$PR_NUMBER/merge"
|
||||||
|
|
||||||
else
|
|
||||||
git push origin update --force
|
|
||||||
fi
|
fi
|
||||||
|
47
.github/workflows/check.yaml
vendored
47
.github/workflows/check.yaml
vendored
@ -5,7 +5,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, reopened, edited, auto_merge_enabled]
|
types: [opened, reopened, edited, auto_merge_enabled, synchronize]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
@ -15,19 +15,52 @@ jobs:
|
|||||||
contains(github.event.head_commit.message, 'bump:') == false &&
|
contains(github.event.head_commit.message, 'bump:') == false &&
|
||||||
contains(github.event.head_commit.message, 'Merge pull request') == false
|
contains(github.event.head_commit.message, 'Merge pull request') == false
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install nix
|
||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
|
||||||
- name: Use Cachix
|
- name: Use cachix
|
||||||
uses: cachix/cachix-action@v16
|
uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
name: trevstack
|
name: trevstack
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
- name: Check
|
- run: nix flake check --accept-flake-config
|
||||||
run: nix flake check
|
|
||||||
|
push:
|
||||||
|
name: push
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: check
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: "0"
|
||||||
|
|
||||||
|
# https://github.com/actions/checkout/issues/13
|
||||||
|
- name: Push to Production
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git push origin main:production
|
||||||
|
|
||||||
|
update:
|
||||||
|
name: update
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ contains(github.event.head_commit.message, 'Merge pull request') }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: "0"
|
||||||
|
|
||||||
|
# https://github.com/actions/checkout/issues/13
|
||||||
|
- name: Push to Production
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git push origin main:production
|
||||||
|
162
.github/workflows/release.yaml
vendored
162
.github/workflows/release.yaml
vendored
@ -13,133 +13,119 @@ jobs:
|
|||||||
check:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install nix
|
||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
|
||||||
- name: Use Cachix
|
- name: Use cachix
|
||||||
uses: cachix/cachix-action@v16
|
uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
name: trevstack
|
name: trevstack
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
- name: Check
|
- run: nix flake check
|
||||||
run: nix flake check
|
|
||||||
|
|
||||||
# release:
|
release:
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# needs: check
|
needs: check
|
||||||
# steps:
|
steps:
|
||||||
# - name: Checkout
|
- uses: actions/checkout@v4
|
||||||
# uses: actions/checkout@v4
|
- uses: ./.actions/init
|
||||||
|
with:
|
||||||
|
token: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
# - name: Install Nix
|
- run: >
|
||||||
# uses: cachix/install-nix-action@v31
|
nix build
|
||||||
# with:
|
.#trevstack-linux-amd64
|
||||||
# nix_path: nixpkgs=channel:nixos-unstable
|
.#trevstack-linux-arm64
|
||||||
|
.#trevstack-linux-arm
|
||||||
|
.#trevstack-windows-amd64
|
||||||
|
.#trevstack-darwin-amd64
|
||||||
|
.#trevstack-darwin-arm64
|
||||||
|
|
||||||
# - name: Use Cachix
|
- uses: softprops/action-gh-release@v2
|
||||||
# uses: cachix/cachix-action@v16
|
with:
|
||||||
# with:
|
generate_release_notes: true
|
||||||
# name: trevstack
|
files: |-
|
||||||
# authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
result*/bin/*
|
||||||
|
|
||||||
# - name: Build
|
|
||||||
# run: >
|
|
||||||
# nix build
|
|
||||||
# .#trevstack-linux-amd64
|
|
||||||
# .#trevstack-linux-arm64
|
|
||||||
# .#trevstack-linux-arm
|
|
||||||
# .#trevstack-windows-amd64
|
|
||||||
# .#trevstack-darwin-amd64
|
|
||||||
# .#trevstack-darwin-arm64
|
|
||||||
|
|
||||||
# - name: Release
|
|
||||||
# uses: softprops/action-gh-release@v2
|
|
||||||
# with:
|
|
||||||
# generate_release_notes: true
|
|
||||||
# files: |-
|
|
||||||
# result*/bin/*
|
|
||||||
|
|
||||||
# https://docs.docker.com/build/ci/github-actions/manage-tags-labels/
|
|
||||||
package:
|
package:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check # Wait for binary cache to propagate
|
needs: release
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install nix
|
||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
|
||||||
- name: Use Cachix
|
- name: Use cachix
|
||||||
uses: cachix/cachix-action@v16
|
uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
name: trevstack
|
name: trevstack
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
- name: Set env
|
- uses: docker/login-action@v3
|
||||||
run: |
|
|
||||||
TAG=${{ github.ref_name }}
|
|
||||||
VERSION=${TAG#v}
|
|
||||||
REPOSITORY=${{ github.repository }}
|
|
||||||
NAME="${REPOSITORY}:${VERSION}"
|
|
||||||
REGISTRY="ghcr.io"
|
|
||||||
|
|
||||||
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
|
||||||
echo "REPOSITORY=${REPOSITORY}" >> $GITHUB_ENV
|
|
||||||
echo "NAME=${NAME}" >> $GITHUB_ENV
|
|
||||||
echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
with:
|
||||||
registry: ${REGISTRY}
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build & Load Images
|
- name: Build & load images
|
||||||
run: |
|
run: |
|
||||||
nix build .#${REPOSITORY}-linux-amd64-image && ./result | docker load
|
nix build .#trevstack-linux-amd64-image && ./result | docker load
|
||||||
nix build .#${REPOSITORY}-linux-arm64-image && ./result | docker load
|
nix build .#trevstack-linux-arm64-image && ./result | docker load
|
||||||
nix build .#${REPOSITORY}-linux-arm-image && ./result | docker load
|
nix build .#trevstack-linux-arm-image && ./result | docker load
|
||||||
|
|
||||||
- name: Push Images
|
- name: Set env
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
docker image tag ${NAME}-amd64 ${REGISTRY}/${NAME}-amd64
|
REGISTRY=$(basename ${{ github.server_url }})
|
||||||
docker push ${REGISTRY}/${NAME}-amd64
|
|
||||||
|
|
||||||
docker image tag ${NAME}-arm64 ${REGISTRY}/${NAME}-arm64
|
NR=${{ github.repository }}
|
||||||
docker push ${REGISTRY}/${NAME}-arm64
|
NAMESPACE="${NR%%/*}"
|
||||||
|
REPOSITORY="${NR##*/}"
|
||||||
|
|
||||||
docker image tag ${NAME}-arm ${REGISTRY}/${NAME}-arm
|
TAG=${{ github.ref_name }}
|
||||||
docker push ${REGISTRY}/${NAME}-arm
|
VERSION=${TAG#v}
|
||||||
|
|
||||||
- name: Push Manifest
|
echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV
|
||||||
|
echo "NAMESPACE=${NAMESPACE}" >> $GITHUB_ENV
|
||||||
|
echo "REPOSITORY=${REPOSITORY}" >> $GITHUB_ENV
|
||||||
|
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Push images
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
docker manifest create ${REGISTRY}/${NAME} \
|
docker image tag $REPOSITORY:$VERSION-amd64 $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64
|
||||||
${REGISTRY}/${NAME}-amd64 \
|
docker push $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64
|
||||||
${REGISTRY}/${NAME}-arm64 \
|
|
||||||
${REGISTRY}/${NAME}-arm
|
|
||||||
|
|
||||||
docker manifest annotate ${REGISTRY}/${NAME} ${REGISTRY}/${NAME}-amd64 --arch amd64
|
docker image tag $REPOSITORY:$VERSION-arm64 $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64
|
||||||
docker manifest annotate ${REGISTRY}/${NAME} ${REGISTRY}/${NAME}-arm64 --arch arm64
|
docker push $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64
|
||||||
docker manifest annotate ${REGISTRY}/${NAME} ${REGISTRY}/${NAME}-arm --arch arm
|
|
||||||
|
|
||||||
docker manifest create ${REGISTRY}/${REPOSITORY}:latest \
|
docker image tag $REPOSITORY:$VERSION-arm $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm
|
||||||
${REGISTRY}/${NAME}-amd64 \
|
docker push $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm
|
||||||
${REGISTRY}/${NAME}-arm64 \
|
|
||||||
${REGISTRY}/${NAME}-arm
|
|
||||||
|
|
||||||
docker manifest annotate ${REGISTRY}/${REPOSITORY}:latest ${REGISTRY}/${NAME}-amd64 --arch amd64
|
- name: Push manifest
|
||||||
docker manifest annotate ${REGISTRY}/${REPOSITORY}:latest ${REGISTRY}/${NAME}-arm64 --arch arm64
|
shell: bash
|
||||||
docker manifest annotate ${REGISTRY}/${REPOSITORY}:latest ${REGISTRY}/${NAME}-arm --arch arm
|
run: |
|
||||||
|
docker manifest create $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64 \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64 \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64 --arch amd64
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64 --arch arm64
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm --arch arm
|
||||||
|
docker manifest push $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION
|
||||||
|
|
||||||
docker manifest push ${REGISTRY}/${NAME}
|
docker manifest create $REGISTRY/$NAMESPACE/$REPOSITORY:latest \
|
||||||
docker manifest push ${REGISTRY}/${REPOSITORY}:latest
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64 \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64 \
|
||||||
|
$REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:latest $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-amd64 --arch amd64
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:latest $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm64 --arch arm64
|
||||||
|
docker manifest annotate $REGISTRY/$NAMESPACE/$REPOSITORY:latest $REGISTRY/$NAMESPACE/$REPOSITORY:$VERSION-arm --arch arm
|
||||||
|
16
.github/workflows/update.yaml
vendored
16
.github/workflows/update.yaml
vendored
@ -13,30 +13,28 @@ jobs:
|
|||||||
update:
|
update:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install nix
|
||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
|
||||||
- name: Use Cachix
|
- name: Use cachix
|
||||||
uses: cachix/cachix-action@v16
|
uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
name: trevstack
|
name: trevstack
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
# https://github.com/actions/checkout/issues/13
|
# https://github.com/actions/checkout/issues/13
|
||||||
- name: Set Git Config
|
- name: Set git config
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
- name: Update
|
- run: nix run .#update
|
||||||
run: nix run .#update
|
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create pull request
|
||||||
id: cpr
|
id: cpr
|
||||||
uses: peter-evans/create-pull-request@v7
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
@ -44,7 +42,7 @@ jobs:
|
|||||||
title: update
|
title: update
|
||||||
body: automatic update
|
body: automatic update
|
||||||
|
|
||||||
- name: Enable Automerge
|
- name: Enable automerge
|
||||||
run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}"
|
run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}"
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.PAT }}
|
GH_TOKEN: ${{ secrets.PAT }}
|
||||||
|
@ -5,13 +5,14 @@ updated=false
|
|||||||
|
|
||||||
echo "updating nix flake"
|
echo "updating nix flake"
|
||||||
cd "${git_root}"
|
cd "${git_root}"
|
||||||
nix flake update
|
nix flake update --accept-flake-config
|
||||||
if ! git diff --exit-code flake.lock; then
|
if ! git diff --exit-code flake.lock; then
|
||||||
git add flake.lock
|
git add flake.lock
|
||||||
git commit -m "build(nix): updated nix dependencies"
|
git commit -m "build(nix): updated nix dependencies"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "updating protobuf deps"
|
echo "updating protobuf deps"
|
||||||
|
cd "${git_root}/proto"
|
||||||
buf dep update
|
buf dep update
|
||||||
if ! git diff --exit-code buf.lock; then
|
if ! git diff --exit-code buf.lock; then
|
||||||
git add buf.lock
|
git add buf.lock
|
||||||
|
2665
client/package-lock.json
generated
2665
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "trevstack",
|
"name": "trevstack",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.39",
|
"version": "0.0.47",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
@ -17,35 +17,35 @@
|
|||||||
"@bufbuild/protovalidate": "^0.1.1",
|
"@bufbuild/protovalidate": "^0.1.1",
|
||||||
"@connectrpc/connect": "^2.0.2",
|
"@connectrpc/connect": "^2.0.2",
|
||||||
"@connectrpc/connect-web": "^2.0.2",
|
"@connectrpc/connect-web": "^2.0.2",
|
||||||
"@eslint/compat": "^1.2.9",
|
"@eslint/compat": "^1.3.1",
|
||||||
"@eslint/js": "^9.18.0",
|
"@eslint/js": "^9.18.0",
|
||||||
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
|
"@ianvs/prettier-plugin-sort-imports": "^4.4.2",
|
||||||
"@lucide/svelte": "^0.479.0",
|
"@lucide/svelte": "^0.479.0",
|
||||||
"@scalar/api-reference": "^1.28.33",
|
"@scalar/api-reference": "^1.32.1",
|
||||||
"@simplewebauthn/browser": "^13.1.0",
|
"@simplewebauthn/browser": "^13.1.0",
|
||||||
"@sveltejs/adapter-static": "^3.0.8",
|
"@sveltejs/adapter-static": "^3.0.8",
|
||||||
"@sveltejs/kit": "^2.21.0",
|
"@sveltejs/kit": "^2.22.0",
|
||||||
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
"@sveltejs/vite-plugin-svelte": "^5.1.0",
|
||||||
"@tailwindcss/vite": "^4.1.6",
|
"@tailwindcss/vite": "^4.1.10",
|
||||||
"bits-ui": "^1.4.8",
|
"bits-ui": "^1.8.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"eslint": "^9.26.0",
|
"eslint": "^9.29.0",
|
||||||
"eslint-config-prettier": "^10.1.5",
|
"eslint-config-prettier": "^10.1.5",
|
||||||
"eslint-plugin-svelte": "^3.6.0",
|
"eslint-plugin-svelte": "^3.9.3",
|
||||||
"globals": "^16.1.0",
|
"globals": "^16.2.0",
|
||||||
"mode-watcher": "^1.0.7",
|
"mode-watcher": "^1.0.8",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.6.1",
|
||||||
"prettier-plugin-svelte": "^3.3.3",
|
"prettier-plugin-svelte": "^3.4.0",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
"prettier-plugin-tailwindcss": "^0.6.13",
|
||||||
"svelte": "^5.28.6",
|
"svelte": "^5.34.8",
|
||||||
"svelte-check": "^4.1.7",
|
"svelte-check": "^4.2.2",
|
||||||
"svelte-sonner": "^0.3.28",
|
"svelte-sonner": "^0.3.28",
|
||||||
"tailwind-merge": "^3.3.0",
|
"tailwind-merge": "^3.3.1",
|
||||||
"tailwind-variants": "^1.0.0",
|
"tailwind-variants": "^1.0.0",
|
||||||
"tailwindcss": "^4.0.13",
|
"tailwindcss": "^4.0.13",
|
||||||
"tw-animate-css": "^1.2.9",
|
"tw-animate-css": "^1.3.4",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"typescript-eslint": "^8.32.1",
|
"typescript-eslint": "^8.35.0",
|
||||||
"vite": "^6.3.5"
|
"vite": "^6.3.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
flake.lock
generated
6
flake.lock
generated
@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1747179050,
|
"lastModified": 1750741721,
|
||||||
"narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=",
|
"narHash": "sha256-Z0djmTa1YmnGMfE9jEe05oO4zggjDmxOGKwt844bUhE=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e",
|
"rev": "4b1164c3215f018c4442463a27689d973cffd750",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
pname = "trevstack";
|
pname = "trevstack";
|
||||||
version = "0.0.39";
|
version = "0.0.47";
|
||||||
|
|
||||||
build-systems = [
|
build-systems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
@ -130,7 +130,7 @@
|
|||||||
pname = "check-client";
|
pname = "check-client";
|
||||||
inherit version;
|
inherit version;
|
||||||
src = ./client;
|
src = ./client;
|
||||||
npmDepsHash = "sha256-HL/1Llrk8+bFSnphWHUwCpHAQqwz5YbG3kAZ8j8p7AU=";
|
npmDepsHash = "sha256-1RIgQhSbU8gsczkNpaaYGXwz9RvFwrF/y4aVKrtBFeM=";
|
||||||
dontNpmInstall = true;
|
dontNpmInstall = true;
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
@ -148,6 +148,7 @@
|
|||||||
sqlfluff
|
sqlfluff
|
||||||
];
|
];
|
||||||
} ''
|
} ''
|
||||||
|
HOME=$PWD
|
||||||
cd ${./server}
|
cd ${./server}
|
||||||
revive -config revive.toml -set_exit_status ./...
|
revive -config revive.toml -set_exit_status ./...
|
||||||
sqlfluff lint
|
sqlfluff lint
|
||||||
@ -193,7 +194,7 @@
|
|||||||
client = pkgs.buildNpmPackage {
|
client = pkgs.buildNpmPackage {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
src = ./client;
|
src = ./client;
|
||||||
npmDepsHash = "sha256-HL/1Llrk8+bFSnphWHUwCpHAQqwz5YbG3kAZ8j8p7AU=";
|
npmDepsHash = "sha256-1RIgQhSbU8gsczkNpaaYGXwz9RvFwrF/y4aVKrtBFeM=";
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
cp -r build "$out"
|
cp -r build "$out"
|
||||||
|
@ -3,7 +3,7 @@ servers:
|
|||||||
- url: /grpc
|
- url: /grpc
|
||||||
info:
|
info:
|
||||||
title: Trevstack API
|
title: Trevstack API
|
||||||
version: 0.0.39
|
version: 0.0.47
|
||||||
description: API for Trevstack
|
description: API for Trevstack
|
||||||
contact:
|
contact:
|
||||||
name: Trev
|
name: Trev
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
version: v2
|
version: v2
|
||||||
deps:
|
deps:
|
||||||
- name: buf.build/bufbuild/protovalidate
|
- name: buf.build/bufbuild/protovalidate
|
||||||
commit: 8976f5be98c146529b1cc15cd2012b60
|
commit: c923a0c2a1324d8b9db81effea973b9c
|
||||||
digest: b5:5d513af91a439d9e78cacac0c9455c7cb885a8737d30405d0b91974fe05276d19c07a876a51a107213a3d01b83ecc912996cdad4cddf7231f91379079cf7488d
|
digest: b5:ba54835683c74e87e751bdc482b7d1c157926024587f453ca3640d3348b846aba3244da145042226842e10876a856e19b6dffc96609167199a450455aef9acf3
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
itemv1 "github.com/spotdemo4/trevstack/server/internal/connect/item/v1"
|
itemv1 "github.com/spotdemo4/trevstack/server/internal/connect/item/v1"
|
||||||
"github.com/spotdemo4/trevstack/server/internal/connect/item/v1/itemv1connect"
|
"github.com/spotdemo4/trevstack/server/internal/connect/item/v1/itemv1connect"
|
||||||
"github.com/spotdemo4/trevstack/server/internal/interceptors"
|
"github.com/spotdemo4/trevstack/server/internal/interceptors"
|
||||||
|
"github.com/spotdemo4/trevstack/server/internal/putil"
|
||||||
"github.com/spotdemo4/trevstack/server/internal/sqlc"
|
"github.com/spotdemo4/trevstack/server/internal/sqlc"
|
||||||
"github.com/spotdemo4/trevstack/server/internal/util"
|
|
||||||
"google.golang.org/protobuf/types/known/timestamppb"
|
"google.golang.org/protobuf/types/known/timestamppb"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -80,9 +80,9 @@ func (h *Handler) GetItems(ctx context.Context, req *connect.Request[itemv1.GetI
|
|||||||
// Get items
|
// Get items
|
||||||
items, err := h.db.GetItems(ctx, sqlc.GetItemsParams{
|
items, err := h.db.GetItems(ctx, sqlc.GetItemsParams{
|
||||||
UserID: userid,
|
UserID: userid,
|
||||||
Name: util.NullLike(req.Msg.Filter),
|
Name: putil.NullLike(req.Msg.Filter),
|
||||||
Start: util.NullTimestamp(req.Msg.Start),
|
Start: putil.NullTimestamp(req.Msg.Start),
|
||||||
End: util.NullTimestamp(req.Msg.End),
|
End: putil.NullTimestamp(req.Msg.End),
|
||||||
Offset: int64(offset),
|
Offset: int64(offset),
|
||||||
Limit: int64(limit),
|
Limit: int64(limit),
|
||||||
})
|
})
|
||||||
@ -97,9 +97,9 @@ func (h *Handler) GetItems(ctx context.Context, req *connect.Request[itemv1.GetI
|
|||||||
// Get items count
|
// Get items count
|
||||||
count, err := h.db.GetItemsCount(ctx, sqlc.GetItemsCountParams{
|
count, err := h.db.GetItemsCount(ctx, sqlc.GetItemsCountParams{
|
||||||
UserID: userid,
|
UserID: userid,
|
||||||
Name: util.NullLike(req.Msg.Filter),
|
Name: putil.NullLike(req.Msg.Filter),
|
||||||
Start: util.NullTimestamp(req.Msg.Start),
|
Start: putil.NullTimestamp(req.Msg.Start),
|
||||||
End: util.NullTimestamp(req.Msg.End),
|
End: putil.NullTimestamp(req.Msg.End),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, connect.NewError(connect.CodeInternal, err)
|
return nil, connect.NewError(connect.CodeInternal, err)
|
||||||
@ -157,8 +157,8 @@ func (h *Handler) UpdateItem(ctx context.Context, req *connect.Request[itemv1.Up
|
|||||||
// set
|
// set
|
||||||
Name: req.Msg.Name,
|
Name: req.Msg.Name,
|
||||||
Description: req.Msg.Description,
|
Description: req.Msg.Description,
|
||||||
Price: util.NullFloat64(req.Msg.Price),
|
Price: putil.NullFloat64(req.Msg.Price),
|
||||||
Quantity: util.NullInt64(req.Msg.Quantity),
|
Quantity: putil.NullInt64(req.Msg.Quantity),
|
||||||
|
|
||||||
// where
|
// where
|
||||||
ID: req.Msg.Id,
|
ID: req.Msg.Id,
|
||||||
|
@ -19,8 +19,8 @@ import (
|
|||||||
userv1 "github.com/spotdemo4/trevstack/server/internal/connect/user/v1"
|
userv1 "github.com/spotdemo4/trevstack/server/internal/connect/user/v1"
|
||||||
"github.com/spotdemo4/trevstack/server/internal/connect/user/v1/userv1connect"
|
"github.com/spotdemo4/trevstack/server/internal/connect/user/v1/userv1connect"
|
||||||
"github.com/spotdemo4/trevstack/server/internal/interceptors"
|
"github.com/spotdemo4/trevstack/server/internal/interceptors"
|
||||||
|
"github.com/spotdemo4/trevstack/server/internal/putil"
|
||||||
"github.com/spotdemo4/trevstack/server/internal/sqlc"
|
"github.com/spotdemo4/trevstack/server/internal/sqlc"
|
||||||
"github.com/spotdemo4/trevstack/server/internal/util"
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ func (h *Handler) UpdatePassword(ctx context.Context, req *connect.Request[userv
|
|||||||
|
|
||||||
// Update password
|
// Update password
|
||||||
err = h.db.UpdateUser(ctx, sqlc.UpdateUserParams{
|
err = h.db.UpdateUser(ctx, sqlc.UpdateUserParams{
|
||||||
Password: util.ToPointer(string(hash)),
|
Password: putil.ToPointer(string(hash)),
|
||||||
ID: userid,
|
ID: userid,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package util
|
package putil
|
||||||
|
|
||||||
func DerefOrEmpty[T any](val *T) T {
|
func DerefOrEmpty[T any](val *T) T {
|
||||||
if val == nil {
|
if val == nil {
|
@ -1,4 +1,4 @@
|
|||||||
package util
|
package putil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
Reference in New Issue
Block a user