Skip to content

Commit 662ef08

Browse files
committed
feat(demo): publish
1 parent 07c0171 commit 662ef08

File tree

94 files changed

+345
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+345
-10
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: Build & Publish Containers
4+
5+
on:
6+
workflow_dispatch:
7+
8+
push:
9+
branches:
10+
- next
11+
- main
12+
13+
env:
14+
USER: alwatr
15+
16+
jobs:
17+
build:
18+
name: Build & Publish Containers
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- name: hybrid-ui-demo-app
26+
path: ./demo/
27+
context: .
28+
29+
permissions:
30+
contents: read
31+
packages: write
32+
id-token: write
33+
34+
steps:
35+
- name: ⤵️ Checkout repository
36+
uses: actions/[email protected]
37+
38+
- name: ❔ Check Container files changed
39+
id: file_change
40+
if: ${{ github.event_name != 'release' && github.event_name != 'workflow_dispatch' }}
41+
uses: dorny/[email protected]
42+
with:
43+
filters: |
44+
container_folder:
45+
${{ matrix.context }}/**
46+
47+
- name: 🏗 Install cosign
48+
if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }}
49+
uses: sigstore/[email protected]
50+
51+
- name: 🏗 Setup Docker Buildx
52+
if: ${{ steps.file_change.outputs.container_folder != 'false' }}
53+
uses: docker/[email protected]
54+
55+
- name: 🏗 Cache Docker Layers
56+
if: ${{ steps.file_change.outputs.container_folder != 'false' }}
57+
uses: actions/[email protected]
58+
with:
59+
path: /tmp/.buildx-cache
60+
key: container/${{ matrix.name }}
61+
62+
# - name: 🏗 Log into docker hub registry
63+
# if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }}
64+
# uses: docker/[email protected]
65+
# with:
66+
# username: ${{env.USER}}
67+
# password: ${{secrets.DOCKER_HUB_TOKEN}}
68+
69+
- name: 🏗 Log into ghcr.io registry
70+
if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }}
71+
uses: docker/[email protected]
72+
with:
73+
registry: ghcr.io
74+
username: ${{env.USER}}
75+
password: ${{secrets.GITHUB_TOKEN}}
76+
77+
- name: 🏗 Extract metadata
78+
if: ${{ steps.file_change.outputs.container_folder != 'false' }}
79+
id: meta
80+
uses: docker/[email protected]
81+
with:
82+
github-token: ${{secrets.GITHUB_TOKEN}}
83+
images: |
84+
name=ghcr.io/${{env.USER}}/${{matrix.name}},enable=true
85+
name=docker.io/${{env.USER}}/${{matrix.name}},enable=false
86+
tags: |
87+
type=semver,enable=true,pattern={{major}}
88+
type=semver,enable=true,pattern={{major}}.{{minor}}
89+
type=semver,enable=true,pattern={{version}}
90+
type=ref,enable=true,event=branch
91+
labels: |
92+
org.opencontainers.image.title="gecut/${{matrix.name}}"
93+
org.opencontainers.image.vendor="Gecut"
94+
org.opencontainers.image.documentation="https://github.com/gecut/hybrid-ui"
95+
org.opencontainers.image.authors="S. MohammadMahdi Zamanian <[email protected]> (https://mm25zamanian.ir)"
96+
97+
- name: 🚀 Build and push container image
98+
if: ${{ steps.file_change.outputs.container_folder != 'false' }}
99+
id: build_and_push
100+
uses: docker/[email protected]
101+
with:
102+
context: ${{matrix.context}}
103+
file: ${{matrix.path}}/Dockerfile
104+
push: ${{ github.event_name != 'pull_request' }}
105+
tags: ${{ steps.meta.outputs.tags }}
106+
labels: ${{ steps.meta.outputs.labels }}
107+
cache-from: type=local,src=/tmp/.buildx-cache
108+
cache-to: type=local,dest=/tmp/.buildx-cache
109+
110+
# - name: 🏗 Sign the image with GitHub OIDC Token
111+
# if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }}
112+
# env:
113+
# COSIGN_EXPERIMENTAL: 'true'
114+
# run: echo "${{steps.meta.outputs.tags}}" | xargs -I {} cosign sign --yes {}@${{steps.build_and_push.outputs.digest}}

demo/.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.git*
2+
.github
3+
.vscode
4+
deploy
5+
dist
6+
Dockerfile
7+
README.md

demo/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM ghcr.io/alwatr/node:21.7.1 as builder
2+
3+
RUN apk add --no-cache git;
4+
RUN set -ex; corepack enable;
5+
6+
COPY . .
7+
8+
RUN set -eux; \
9+
yarn install --immutable; \
10+
yarn build; \
11+
ls -lahF .; \
12+
ls -RlahF /app/demo;
13+
14+
# ---
15+
16+
FROM ghcr.io/alwatr/nginx-cdn:2.5.0 as nginx
17+
LABEL org.opencontainers.image.base.name="ghcr.io/alwatr/nginx-cdn:2.5.0"
18+
19+
COPY --from=builder /app/demo/dist/ .
20+
21+
RUN pwd; ls -lAhF;
22+
23+
EXPOSE 80

demo/assets/tick.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

demo/button/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Gecut Buttons</title>
7+
<link rel="icon" href="/favicon.ico" sizes="any" />
8+
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
9+
<link rel="manifest" href="/manifest.json" />
710
<script type="module" src="../main/global.ts"></script>
811
<script type="module" src="./scripts.ts"></script>
912
</head>

demo/dialog/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Gecut Dialog</title>
7+
<link rel="icon" href="/favicon.ico" sizes="any" />
8+
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
9+
<link rel="manifest" href="/manifest.json" />
710
<script type="module" src="../main/global.ts"></script>
811
<script type="module" src="./scripts.ts"></script>
912
</head>

demo/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Gecut</title>
7+
<link rel="icon" href="/favicon.ico" sizes="any" />
8+
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
9+
<link rel="manifest" href="/manifest.json" />
710
<script type="module" src="main/scripts.ts"></script>
811
<script type="module" src="main/global.ts"></script>
912
</head>

demo/lists/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Gecut Lists</title>
7+
<link rel="icon" href="/favicon.ico" sizes="any" />
8+
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
9+
<link rel="manifest" href="/manifest.json" />
710
<script type="module" src="../main/global.ts"></script>
811
<script type="module" src="./scripts.ts"></script>
912
</head>

demo/lists/scripts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {map} from 'lit/directives/map.js';
44
import {range} from 'lit/directives/range.js';
55
import {html, render} from 'lit/html.js';
66

7-
import placeHolderImage from '../assets/placeholder.webp';
7+
import placeHolderImage from '../public/placeholder.webp';
88

99
render(
1010
html`

demo/main/scripts.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ import {classMap} from 'lit/directives/class-map.js';
33
import {map} from 'lit/directives/map.js';
44
import {html, render} from 'lit/html.js';
55

6+
import button from '../public/previews/button.png';
7+
import dialog from '../public/previews/dialog.png';
8+
import lists from '../public/previews/lists.png';
9+
import topBar from '../public/previews/top-bar.png';
10+
611
interface Demo {
712
title: string;
813
href: string;
14+
imageSource: string;
915

1016
align?: 'center' | 'bottom' | 'top';
1117
}
@@ -15,21 +21,23 @@ const demos: Demo[] = [
1521
{
1622
title: 'Commons Buttons',
1723
href: '/button/',
18-
align: 'center',
24+
imageSource: button,
1925
},
2026
{
2127
title: 'Dialog',
2228
href: '/dialog/',
23-
align: 'center',
29+
imageSource: dialog,
2430
},
2531
{
2632
title: 'Top App Bar',
2733
href: '/top-bar/',
34+
imageSource: topBar,
2835
align: 'top',
2936
},
3037
{
3138
title: 'Lists',
3239
href: '/lists/',
40+
imageSource: lists,
3341
align: 'top',
3442
},
3543
];
@@ -45,7 +53,7 @@ if (container)
4553
>
4654
<div class="aspect-w-4 aspect-h-3 w-full overflow-hidden rounded-md relative">
4755
<img
48-
src="${demo.href}preview.png"
56+
src=${demo.imageSource}
4957
class="h-full w-full object-cover invert dark:invert-0 ${classMap({
5058
'object-center': demo.align === 'center' || !demo.align,
5159
'object-top': demo.align === 'top',

0 commit comments

Comments
 (0)