-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
146 lines (131 loc) · 4.19 KB
/
release.yml
File metadata and controls
146 lines (131 loc) · 4.19 KB
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
141
142
143
144
145
146
name: Release & Publish
on:
push:
tags:
- "V*"
workflow_dispatch:
inputs:
release_apps:
description: "Build popular apps"
type: boolean
default: false
publish_docker:
description: "Publish Docker image"
type: boolean
default: false
env:
NODE_VERSION: "22"
PNPM_VERSION: "10.26.2"
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
# Build and release popular apps
release-apps:
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'workflow_dispatch' && inputs.release_apps)
runs-on: ubuntu-latest
outputs:
apps_name: ${{ steps.read-apps-config.outputs.apps_name }}
apps_config: ${{ steps.read-apps-config.outputs.apps_config }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Get Apps Config
id: read-apps-config
run: |
echo "apps_name=$(jq -c '[.[] | .name]' default_app_list.json)" >> $GITHUB_OUTPUT
echo "apps_config=$(jq -c '.' default_app_list.json)" >> $GITHUB_OUTPUT
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Create release placeholder
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
skipIfReleaseExists: true
build-cli:
name: Build CLI
needs: release-apps
if: needs.release-apps.result == 'success'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js Environment
uses: ./.github/actions/setup-env
with:
mode: 'node'
- name: Build CLI
run: pnpm run cli:build
- name: Upload CLI Artifact
uses: actions/upload-artifact@v6
with:
name: pake-cli-dist
path: dist/
retention-days: 1
build-popular-apps:
name: ${{ matrix.config.title }}
needs: [release-apps, build-cli, create-release]
if: |
needs.release-apps.result == 'success' &&
needs.build-cli.result == 'success' &&
(needs.create-release.result == 'success' || needs.create-release.result == 'skipped')
strategy:
matrix:
config: ${{ fromJSON(needs.release-apps.outputs.apps_config) }}
uses: ./.github/workflows/single-app.yaml
secrets: inherit
with:
name: ${{ matrix.config.name }}
title: ${{ matrix.config.title }}
name_zh: ${{ matrix.config.name_zh }}
url: ${{ matrix.config.url }}
icon: ${{ matrix.config.icon }}
new_window: ${{ matrix.config.new_window || false }}
incognito: ${{ matrix.config.incognito || false }}
width: ${{ matrix.config.width || 1200 }}
height: ${{ matrix.config.height || 780 }}
# Publish Docker image (runs in parallel with app builds)
publish-docker:
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'workflow_dispatch' && inputs.publish_docker)
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max