Skip to content

Commit

Permalink
ci: setup build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwitzko committed Feb 7, 2024
1 parent 2c88cc7 commit 9816789
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- uses: oven-sh/setup-bun@v1
- uses: docker/login-action@v2
with:
registry: ghcr.io
Expand Down
4 changes: 4 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
before:
hooks:
- ./scripts/build-webui.sh {{.Version}}

builds:
- env:
- CGO_ENABLED=0
Expand Down
13 changes: 13 additions & 0 deletions scripts/build-webui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -euo pipefail

[[ -z "${1:-}" ]] && echo "Usage: $0 <version>" && exit 1

export VERSION="${1}"
echo "building webui ($VERSION)..."

cd webui
bun install
rm -rf out
bun run build
Binary file modified webui/bun.lockb
Binary file not shown.
35 changes: 19 additions & 16 deletions webui/lib/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,28 @@ export function AuthProvider({ children }: { children: ReactNode }) {
const [error, setError] = useState("");
const [username, setUsername] = useState("");

const login = useCallback((username: string, password: string) => {
setIsLoading(true);
setToken("");
setError("");
createToken(username, password)
.then((token) => {
setToken(token);
})
.catch((err) => {
setError(err.message);
})
.finally(() => {
setIsLoading(false);
});
}, []);
const login = useCallback(
(username: string, password: string) => {
setIsLoading(true);
setToken("");
setError("");
createToken(username, password)
.then((token) => {
setToken(token);
})
.catch((err) => {
setError(err.message);
})
.finally(() => {
setIsLoading(false);
});
},
[setToken],
);

const logout = useCallback(() => {
removeItem();
}, []);
}, [removeItem]);

useEffect(() => {
if (isSSR) {
Expand Down

0 comments on commit 9816789

Please sign in to comment.