Skip to content

Commit 5227abf

Browse files
authored
feat: add GitHub deployment environments for containers, docs, and homebrew (#1424)
* feat: add GitHub deployment environments for containers, docs, and homebrew * fix: lowercase GHCR owner to satisfy registry naming requirement github.repository_owner returns 'MFlowCode' (mixed case), but GHCR requires all-lowercase repository names, causing tag validation errors. Compute GH_REGISTRY=ghcr.io/${OWNER,,}/mfc in a shell step so the lowercasing happens at runtime rather than at expression-eval time. * fix: use DOCKERHUB_USERNAME secret in containers environment URL
1 parent 9c62fce commit 5227abf

4 files changed

Lines changed: 40 additions & 7 deletions

File tree

.github/workflows/deploy-tap.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
permissions:
2929
contents: write
3030
pull-requests: write
31+
environment:
32+
name: homebrew
33+
url: https://github.com/MFlowCode/homebrew-mfc
3134
steps:
3235
- name: Checkout MFC repository
3336
uses: actions/checkout@v4

.github/workflows/docker.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ jobs:
7171
fi
7272
echo "tag=$TAG" >> $GITHUB_OUTPUT
7373
echo "TAG=$TAG" >> $GITHUB_ENV
74+
OWNER="${{ github.repository_owner }}"
75+
echo "GH_REGISTRY=ghcr.io/${OWNER,,}/mfc" >> $GITHUB_ENV
7476
git clone --branch "$BRANCH" --depth 1 ${{ github.server_url }}/${{ github.repository }}.git mfc
7577
7678
- name: Stage
@@ -107,7 +109,7 @@ jobs:
107109
org.opencontainers.image.source=https://github.com/${{ github.repository }}
108110
tags: |
109111
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner }}
110-
ghcr.io/${{ github.repository_owner }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner }}
112+
${{ env.GH_REGISTRY }}:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner }}
111113
push: true
112114

113115
- name: Build and push image (gpu)
@@ -129,12 +131,15 @@ jobs:
129131
org.opencontainers.image.source=https://github.com/${{ github.repository }}
130132
tags: |
131133
${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner }}
132-
ghcr.io/${{ github.repository_owner }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner }}
134+
${{ env.GH_REGISTRY }}:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner }}
133135
push: true
134136

135137
manifests:
136138
runs-on: ubuntu-latest
137139
needs: Container
140+
environment:
141+
name: containers
142+
url: https://hub.docker.com/r/${{ secrets.DOCKERHUB_USERNAME }}/mfc
138143
steps:
139144
- name: Login to Docker Hub
140145
uses: docker/login-action@v3
@@ -152,12 +157,17 @@ jobs:
152157
- name: Setup Buildx
153158
uses: docker/setup-buildx-action@v3
154159

160+
- name: Set GHCR registry (lowercase)
161+
run: |
162+
OWNER="${{ github.repository_owner }}"
163+
echo "GH_REGISTRY=ghcr.io/${OWNER,,}/mfc" >> $GITHUB_ENV
164+
155165
- name: Create and Push Manifest Lists
156166
env:
157167
TAG: ${{ needs.Container.outputs.tag }}
158168
DH: ${{ secrets.DOCKERHUB_USERNAME }}/mfc
159-
GH: ghcr.io/${{ github.repository_owner }}/mfc
160169
run: |
170+
GH="${{ env.GH_REGISTRY }}"
161171
for R in "$DH" "$GH"; do
162172
docker buildx imagetools create -t $R:$TAG-cpu $R:$TAG-cpu-ubuntu-22.04 $R:$TAG-cpu-ubuntu-22.04-arm
163173
docker buildx imagetools create -t $R:$TAG-gpu $R:$TAG-gpu-ubuntu-22.04 $R:$TAG-gpu-ubuntu-22.04-arm
@@ -168,8 +178,8 @@ jobs:
168178
env:
169179
TAG: ${{ needs.Container.outputs.tag }}
170180
DH: ${{ secrets.DOCKERHUB_USERNAME }}/mfc
171-
GH: ghcr.io/${{ github.repository_owner }}/mfc
172181
run: |
182+
GH="${{ env.GH_REGISTRY }}"
173183
for R in "$DH" "$GH"; do
174184
docker buildx imagetools create -t $R:latest-cpu $R:$TAG-cpu-ubuntu-22.04 $R:$TAG-cpu-ubuntu-22.04-arm
175185
docker buildx imagetools create -t $R:latest-gpu $R:$TAG-gpu-ubuntu-22.04 $R:$TAG-gpu-ubuntu-22.04-arm

.github/workflows/docs.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
pull_request:
1010

1111
jobs:
12-
docs:
13-
name: Build & Publish
12+
build:
13+
name: Build & Verify
1414
runs-on: ubuntu-latest
1515

1616
steps:
@@ -73,8 +73,25 @@ jobs:
7373
args: -c .lychee.toml build/install/docs/mfc/
7474
fail: true
7575

76+
publish:
77+
name: Publish
78+
runs-on: ubuntu-latest
79+
needs: build
80+
if: github.repository == 'MFlowCode/MFC' && github.ref == 'refs/heads/master' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
81+
environment:
82+
name: docs
83+
url: https://mflowcode.github.io/
84+
85+
steps:
86+
- uses: actions/checkout@v4
87+
88+
- name: Download Built Documentation Artifact
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: mfc-docs
92+
path: build/install/docs/mfc
93+
7694
- name: Publish Documentation
77-
if: github.repository == 'MFlowCode/MFC' && github.ref == 'refs/heads/master' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' )
7895
run: |
7996
set +e
8097
git ls-remote "${{ secrets.DOC_PUSH_URL }}" -q

.github/workflows/homebrew-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
update-homebrew-tap:
2626
name: Update homebrew-mfc tap
2727
runs-on: ubuntu-latest
28+
environment:
29+
name: homebrew
30+
url: https://github.com/MFlowCode/homebrew-mfc
2831

2932
steps:
3033
- name: Determine version

0 commit comments

Comments
 (0)