Skip to content

Commit aad7a23

Browse files
authored
157 preflight checks build images workflows (#159)
1 parent 5f8cc5b commit aad7a23

File tree

4 files changed

+180
-188
lines changed

4 files changed

+180
-188
lines changed

.github/workflows/preview.yaml renamed to .github/workflows/build-publish-ephemeral.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: pull-requests-preview-deployment
1+
name: Manage Pull Request Preview Instances
22

33
on:
44
pull_request:
@@ -11,13 +11,16 @@ on:
1111
concurrency: preview-${{ github.ref }}
1212

1313
jobs:
14-
deploy-preview:
15-
environment: pull-requests-preview
14+
deploy-ephemeral-preview:
15+
name: Deploy or Remove Ephemeral Preview
16+
environment:
17+
name: pull-requests-preview
18+
url: 'https://${{ github.repository_owner }}.github.io${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }}'
1619
runs-on: ubuntu-20.04
1720

1821
steps:
1922
- name: Checkout
20-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2124

2225
- name: Get Commit Hash
2326
id: commit_hash
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Build and Deploy Production Docker Images
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-stable:
11+
name: Build Production Artifacts
12+
environment:
13+
name: stable
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup NodeJS
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 'lts/*'
24+
25+
- name: Install NodeJS Dependencies
26+
run: npm install
27+
28+
- name: Build Version Tag
29+
id: build_version_tag
30+
run: echo "IMAGE_SEMVER=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
31+
32+
- name: Build Container Image Metadata
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
# list of Docker images to use as base name for tags
37+
images: |
38+
${{ vars.REGISTRY }}/${{ vars.REGISTRY_ORG }}/${{ vars.IMG_NAME }}
39+
# generate Docker tags based on the following events/attributes
40+
tags: |
41+
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
42+
type=raw,value=latest
43+
44+
45+
- name: Build App
46+
env:
47+
REACT_APP_VERSION: ${{ env.IMAGE_SEMVER }}
48+
REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }}
49+
REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }}
50+
REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}
51+
REACT_APP_TYPESENSE_PROTOCOL: ${{ vars.TYPESENSE_PROTOCOL }}
52+
REACT_APP_TYPESENSE_HOST: ${{ vars.TYPESENSE_HOST }}
53+
REACT_APP_TYPESENSE_PORT: ${{ vars.TYPESENSE_PORT }}
54+
REACT_APP_TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_SEARCH_KEY }}
55+
UMAMI_WEBSITE_ID: ${{ vars.UMAMI_WEBSITE_ID }}
56+
UMAMI_ANALYTICS_DOMAIN: ${{ vars.UMAMI_ANALYTICS_DOMAIN }}
57+
UMAMI_DATAHOST_URL: ${{ vars.UMAMI_DATAHOST_URL }}
58+
UMAMI_DATA_DOMAIN: ${{ vars.UMAMI_DATA_DOMAINS }}
59+
run: npm run build
60+
61+
- name: Login to Container Registry
62+
uses: docker/login-action@v3
63+
with:
64+
registry: ${{ vars.REGISTRY }}
65+
username: ${{ secrets.REGISTRY_USER }}
66+
password: ${{ secrets.REGISTRY_PASSWORD }}
67+
68+
- name: Setup Docker Buildx
69+
id: buildx
70+
uses: docker/[email protected]
71+
72+
- name: Build and Push (Docker Image)
73+
id: docker_build
74+
uses: docker/[email protected]
75+
with:
76+
context: ./
77+
file: ./Dockerfile
78+
provenance: false
79+
push: ${{ github.event_name != 'pull_request' }}
80+
tags: ${{ steps.meta.outputs.tags }}
81+
labels: ${{ steps.meta.outputs.labels }}
82+
annotations: ${{ steps.meta.outputs.annotations }}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Build and Deploy Staging Docker Images
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**/README.md'
9+
- '**/CONTRIBUTING.md'
10+
- '**/CONFIGURATION.md'
11+
- '**/.devcontainer/**'
12+
- "**/.github/workflows/**"
13+
14+
jobs:
15+
build-preview:
16+
name: Build Staging Artifacts
17+
environment:
18+
name: preview
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup NodeJS
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 'lts/*'
29+
30+
- name: Install NodeJS Dependencies
31+
run: npm install
32+
33+
- name: Get Commit Hash
34+
id: commit_hash
35+
uses: prompt/actions-commit-hash@v3
36+
37+
- name: Get Current Date
38+
id: date
39+
run: echo "today=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
40+
41+
- name: Build Image Tag
42+
id: build_image_tag
43+
run: echo "image_version=${{ steps.date.outputs.today }}-${{github.run_number}}-${{ steps.commit_hash.outputs.short }}" >> $GITHUB_OUTPUT
44+
45+
- name: Build Container Image Metadata
46+
id: meta
47+
uses: docker/metadata-action@v5
48+
with:
49+
images: |
50+
${{ vars.REGISTRY }}/${{ vars.REGISTRY_ORG }}/${{ vars.IMG_NAME }}
51+
tags: |
52+
type=raw,value=${{ steps.build_image_tag.outputs.image_version }}
53+
54+
- name: Build App
55+
env:
56+
REACT_APP_VERSION: ${{ steps.build_image_tag.outputs.image_version }}
57+
REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }}
58+
REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }}
59+
REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}
60+
REACT_APP_TYPESENSE_PROTOCOL: ${{ vars.TYPESENSE_PROTOCOL }}
61+
REACT_APP_TYPESENSE_HOST: ${{ vars.TYPESENSE_HOST }}
62+
REACT_APP_TYPESENSE_PORT: ${{ vars.TYPESENSE_PORT }}
63+
REACT_APP_TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_SEARCH_KEY }}
64+
UMAMI_WEBSITE_ID: ${{ vars.UMAMI_WEBSITE_ID }}
65+
UMAMI_ANALYTICS_DOMAIN: ${{ vars.UMAMI_ANALYTICS_DOMAIN }}
66+
UMAMI_DATAHOST_URL: ${{ vars.UMAMI_DATAHOST_URL }}
67+
UMAMI_DATA_DOMAIN: ${{ vars.UMAMI_DATA_DOMAINS }}
68+
run: npm run build
69+
70+
- name: Login to Container Registry
71+
uses: docker/login-action@v3
72+
with:
73+
registry: ${{ vars.REGISTRY }}
74+
username: ${{ secrets.REGISTRY_USER }}
75+
password: ${{ secrets.REGISTRY_PASSWORD }}
76+
77+
- name: Setup Docker Buildx
78+
id: buildx
79+
uses: docker/[email protected]
80+
81+
- name: Build and Push (Docker Image)
82+
id: docker_build
83+
uses: docker/[email protected]
84+
with:
85+
context: ./
86+
file: ./Dockerfile
87+
provenance: false
88+
push: ${{ github.event_name != 'pull_request' }}
89+
tags: ${{ steps.meta.outputs.tags }}
90+
labels: ${{ steps.meta.outputs.labels }}
91+
annotations: ${{ steps.meta.outputs.annotations }}

.github/workflows/release.yaml

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

0 commit comments

Comments
 (0)