Skip to content

Commit 6c700fd

Browse files
committed
move logic to shared composite action
1 parent 702ef51 commit 6c700fd

File tree

5 files changed

+117
-72
lines changed

5 files changed

+117
-72
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Publish Self-Hostable Docs
2+
description: Build and publish self-hostable docs to Docker Hub
3+
4+
inputs:
5+
version:
6+
description: 'Version to publish'
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Check for Environment Variables
13+
id: check_env
14+
shell: bash
15+
run: |
16+
if [ -z "$FERN_API_DOCKERHUB_PASSWORD" ]; then echo "FERN_API_DOCKERHUB_PASSWORD is not set"; exit 1; fi
17+
if [ -z "$TURBO_TOKEN" ]; then echo "TURBO_TOKEN is not set"; exit 1; fi
18+
if [ -z "$TURBO_TEAM" ]; then echo "TURBO_TEAM is not set"; exit 1; fi
19+
if [ -z "$FERN_TOKEN" ]; then echo "FERN_TOKEN is not set"; exit 1; fi
20+
21+
- name: Debug Print Version
22+
run: |
23+
echo "Version: ${{ inputs.version }}"
24+
25+
# - uses: actions/checkout@v4
26+
# with:
27+
# fetch-depth: 2
28+
29+
# - name: Update Engines
30+
# run: |
31+
# node -e 'const fs = require("fs"); const pkg = require("./package.json"); console.log("Before modification:", JSON.stringify(pkg.engines, null, 2)); pkg.engines.node = ">=20.0.0"; pkg.engines.pnpm = "9.15.9"; pkg.packageManager = "[email protected]"; console.log("After modification:", JSON.stringify(pkg.engines, null, 2)); fs.writeFileSync("./package.json", JSON.stringify(pkg, null, 2));'
32+
33+
# - name: Install
34+
# uses: ./.github/actions/legacy-install
35+
36+
# - name: Compile
37+
# run: pnpm compile
38+
39+
# - name: Build FDR CJS
40+
# run: pnpm --filter @fern-platform/fdr build:tsup:cjs
41+
# - name: Build self-hosted bundle
42+
# run: pnpm docs:self-hosted-bundle:build
43+
44+
# - name: Set up Docker Buildx
45+
# uses: docker/setup-buildx-action@v3
46+
47+
# - name: Login to Docker Hub
48+
# uses: docker/login-action@v3
49+
# with:
50+
# username: fernapi
51+
# password: ${{ env.FERN_API_DOCKERHUB_PASSWORD }}
52+
53+
# - name: Build Docker image
54+
# run: pnpm --filter=@fern-platform/self-hosted docker:build
55+
56+
# - name: Push to Docker Hub
57+
# run: |
58+
# echo "Pushing to Docker Hub with version: ${{ inputs.version }}"
59+
# docker tag fern-self-hosted:latest fernapi/fern-self-hosted:${{ inputs.version }}
60+
# docker push fernapi/fern-self-hosted:${{ inputs.version }}

.github/actions/get-latest-docker-tag/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ outputs:
1414
runs:
1515
using: composite
1616
steps:
17+
- name: Check for Environment Variables
18+
id: check_env
19+
shell: bash
20+
run: |
21+
if [ -z "$DOCKER_PASSWORD" ]; then echo "DOCKER_PASSWORD is not set"; exit 1; fi
22+
1723
- name: Get latest tag
1824
id: get_tag
1925
shell: bash

.github/workflows/publish-self-hostable-docs-cron.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ on:
77
push:
88
branches: [ jsklan/weekly-selfhosted-publish ]
99

10+
env:
11+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
12+
TURBO_TEAM: "buildwithfern"
13+
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
14+
1015
jobs:
11-
get-next-tag:
16+
get-next-tag-and-build-and-publish:
1217
runs-on: ubuntu-latest
1318
outputs:
1419
new_tag: ${{ steps.determine_new_tag.outputs.new_tag }}
@@ -27,16 +32,21 @@ jobs:
2732

2833
- name: Determine new tag
2934
id: determine_new_tag
35+
# Should eventually gather more context to determine what type of semver increase to do
36+
# For now, we always increment the minor version
3037
run: |
3138
echo "Current latest tag is ${{ steps.get_latest_tag.outputs.tag }}"
3239
LATEST_TAG="${{ steps.get_latest_tag.outputs.tag }}"
3340
NEW_TAG=$(echo $LATEST_TAG | awk -F. '{print $1"."$2+1".0"}')
3441
echo "New tag is $NEW_TAG"
3542
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
3643
37-
publish-docs:
38-
needs: get-next-tag
39-
uses: ./.github/workflows/publish-self-hostable-docs.yml
40-
secrets: inherit
41-
with:
42-
version: ${{ needs.get-next-tag.outputs.new_tag }}
44+
- name: Build and Publish Self-Hostable Docs
45+
uses: ./.github/actions/build-and-publish-self-hostable-docs
46+
with:
47+
version: ${{ steps.determine_new_tag.outputs.new_tag }}
48+
env:
49+
FERN_API_DOCKERHUB_PASSWORD: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
50+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
51+
TURBO_TEAM: "buildwithfern"
52+
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Self-Hostable Docs
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to publish'
8+
required: false
9+
type: string
10+
11+
env:
12+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
13+
TURBO_TEAM: "buildwithfern"
14+
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
15+
16+
jobs:
17+
build-and-publish:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
new_tag: ${{ steps.determine_new_tag.outputs.new_tag }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 2 # This helps turbo resolve changes faster
25+
26+
- name: Build and Publish Self-Hostable Docs
27+
uses: ./.github/actions/build-and-publish-self-hostable-docs
28+
with:
29+
version: ${{ github.event.inputs.version || 'latest' }}
30+
env:
31+
FERN_API_DOCKERHUB_PASSWORD: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
32+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
33+
TURBO_TEAM: "buildwithfern"
34+
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}

.github/workflows/publish-self-hostable-docs.yml

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

0 commit comments

Comments
 (0)