镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Commit 7eab2ab

Browse files
committed
fix: keep Launchpad deployment ownership in its own repository
1 parent 0a40642 commit 7eab2ab

4 files changed

Lines changed: 47 additions & 172 deletions

File tree

‎.github/scripts/deploy/attached-sites.test.ts‎

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { expect, test } from 'bun:test'
2+
import { readFileSync } from 'node:fs'
3+
4+
const text = readFileSync(new URL('../../workflows/configure-launchpad-deployment.yml', import.meta.url), 'utf8')
5+
const workflow = Bun.YAML.parse(text) as any
6+
7+
test('host credential setup is protected and never deploys an attached application', () => {
8+
expect(workflow.jobs.configure.if).toContain("github.ref == 'refs/heads/main'")
9+
expect(workflow.jobs.configure.environment).toBe('production')
10+
expect(text).toContain('--repo stacksjs/launchpad --env website-production')
11+
expect(text).not.toContain('./buddy deploy')
12+
expect(text).not.toContain('secrets.DOTENV_PRIVATE_KEY_PRODUCTION')
13+
expect(text).not.toContain('PORKBUN_SECRET_KEY')
14+
})
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Configure Launchpad deployment access
2+
3+
# Host credential setup only. Launchpad owns its cloud configuration and deploys
4+
# its website and API from stacksjs/launchpad through cloud.attachTo.
5+
on:
6+
workflow_dispatch:
7+
permissions:
8+
contents: read
9+
jobs:
10+
configure:
11+
if: github.ref == 'refs/heads/main'
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
environment: production
15+
steps:
16+
- name: Configure the dedicated protected deployment environment
17+
env:
18+
GH_TOKEN: ${{ secrets.GH_PAT }}
19+
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}
20+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
21+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
22+
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
23+
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
24+
run: |
25+
set -euo pipefail
26+
test -n "$GH_TOKEN"
27+
for name in HCLOUD_TOKEN CLOUDFLARE_API_TOKEN CLOUDFLARE_ACCOUNT_ID DEPLOY_SSH_KEY; do
28+
test -n "${!name}"
29+
printf '%s' "${!name}" | gh secret set "$name" --repo stacksjs/launchpad --env website-production
30+
done
31+
if [ -n "$SSH_KNOWN_HOSTS" ]; then
32+
printf '%s' "$SSH_KNOWN_HOSTS" | gh secret set SSH_KNOWN_HOSTS --repo stacksjs/launchpad --env website-production
33+
fi

‎.github/workflows/deploy-attached-sites.yml‎

Lines changed: 0 additions & 139 deletions
This file was deleted.

0 commit comments

Comments
 (0)