Merge pull request #242 from Cloud-Temple/SLU-20260119 #676
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Workflow | |
| on: | |
| push: | |
| branches: | |
| - "*" | |
| create: | |
| tags: | |
| - "*" | |
| jobs: | |
| # Job for the dev branch (GitHub Pages deployment) | |
| deploy-dev: | |
| name: Deploy Documentation to GitHub Pages | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/dev' | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: dev # Ensure this matches your GitHub environment name | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build Documentation | |
| run: yarn build | |
| - name: Upload Build Artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: build | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| # Job for feature branches (building and pushing an unversioned Docker image) | |
| build-branch: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' && !startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build Documentation | |
| env: | |
| BASE_URL: "/" | |
| run: yarn build | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Extract Branch Name | |
| id: extract_branch | |
| run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
| - name: Log in to DockerHub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./docker/production/Dockerfile.prebuilt | |
| push: true | |
| platforms: linux/amd64,linux/arm64/v8 | |
| tags: cloudtempleinfra/docs:${{ env.BRANCH_NAME }} | |
| # Job for the main branch (building and pushing an unversioned Docker image) | |
| build-main: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build Documentation | |
| env: | |
| BASE_URL: "/" | |
| run: yarn build | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Log in to DockerHub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./docker/production/Dockerfile.prebuilt | |
| push: true | |
| platforms: linux/amd64,linux/arm64/v8 | |
| tags: cloudtempleinfra/docs:main | |
| # Job for tags (building and pushing a versioned Docker image) | |
| build-tag: | |
| name: Build and Push Versioned Docker Image | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build Documentation | |
| env: | |
| BASE_URL: "/" | |
| run: yarn build | |
| - name: Extract Tag Name | |
| id: extract_tag | |
| run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Log in to DockerHub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./docker/production/Dockerfile.prebuilt | |
| push: true | |
| platforms: linux/amd64,linux/arm64/v8 | |
| tags: | | |
| cloudtempleinfra/docs:${{ env.TAG }} | |
| cloudtempleinfra/docs:latest |