Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Create build_codex_fe.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tsubramanian authored Sep 21, 2023
1 parent 192b821 commit e555bfa
Showing 1 changed file with 186 additions and 0 deletions.
186 changes: 186 additions & 0 deletions .github/workflows/build_codex_fe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
name: Build

on:
pull_request:
branches:
- dockerbuild-fix
push:
branches:
- dockerbuild-fix
tags:
- v*
schedule:
- cron: '0 16 * * *' # Every day at 16:00 UTC (~09:00 PT)

jobs:
build:
name: Build releasable package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '17.x'

- name: Install dependencies and compile
run: ./scripts/build.npm.sh

- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10

- name: Package the build
run: |
mv dist codex-frontend
tar -czvf codex-frontend.tar.gz codex-frontend/
- uses: actions/upload-artifact@v2
with:
name: codex-frontend
path: codex-frontend.tar.gz
# default:
# retention-days: 90

deploy:
name: Docker image build
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
if: github.event_name == 'schedule'
with:
ref: develop

- uses: actions/checkout@v2
if: github.event_name != 'schedule'

- uses: docker/setup-qemu-action@v1
name: Set up QEMU
id: qemu
with:
image: tonistiigi/binfmt:latest
platforms: all

- uses: docker/setup-buildx-action@v1
name: Set up Docker Buildx
id: buildx

- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

# Build images
- name: Build Codex
run: |
./scripts/buildx.docker.sh -i codex-frontend
# Log into container registries
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: wildmeorg
password: ${{ secrets.WBIA_WILDMEBOT_DOCKER_HUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}

# Push tagged image (version tag + latest) to registries
- name: Tagged Docker Hub
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
run: |
VERSION=$(echo ${GITHUB_REF} | sed 's#.*/v##')
./scripts/buildx.docker.sh -t ${VERSION} -i codex-frontend
./scripts/buildx.docker.sh -t latest -i codex-frontend
- name: Tagged GHCR
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
run: |
VERSION=$(echo ${GITHUB_REF} | sed 's#.*/v##')
./scripts/buildx.docker.sh -t ${VERSION} -r ghcr.io/wildmeorg/codex-frontend -i codex-frontend
./scripts/buildx.docker.sh -t latest -r ghcr.io/wildmeorg/codex-frontend -i codex-frontend
# Push stable image (main tag) to registries
- name: Stable Docker Hub
if: github.ref == 'refs/heads/dockerbuild-fix'
run: |
./scripts/buildx.docker.sh -t dockerbuild-fix -i codex-frontend
- name: Stable GHCR
if: github.ref == 'refs/heads/dockerbuild-fix1'
run: |
./scripts/buildx.docker.sh -t develop -r ghcr.io/wildmeorg/codex-frontend -i codex-frontend
# Push bleeding-edge image (develop tag) to registries
- name: Bleeding Edge Docker Hub
if: github.ref == 'refs/heads/develop'
run: |
./scripts/buildx.docker.sh -t develop -i codex-frontend
- name: Bleeding Edge GHCR
if: github.ref == 'refs/heads/develop'
run: |
./scripts/buildx.docker.sh -t develop -r ghcr.io/wildmeorg/codex-frontend -i codex-frontend
# Push nightly image (nightly tag) to registries
- name: Nightly Docker Hub
if: github.event_name == 'schedule'
run: |
./scripts/buildx.docker.sh -t nightly -i codex-frontend
- name: Nightly GHCR
if: github.event_name == 'schedule'
run: |
./scripts/buildx.docker.sh -t nightly -r ghcr.io/wildmeorg/codex-frontend -i codex-frontend
# Notify status in Slack
- name: Slack Notification
if: ${{ failure() && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
uses: rtCamp/action-slack-notify@master
env:
SLACK_CHANNEL: dev-houston
SLACK_COLOR: '#FF0000'
SLACK_ICON: https://avatars.slack-edge.com/2020-03-02/965719891842_db87aa21ccb61076f236_44.png
SLACK_MESSAGE: 'Tagged / Latest Docker build of Codex Frontend failed :sob:'
SLACK_USERNAME: "GitHub CI"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

- name: Slack Notification
if: ${{ failure() && github.ref == 'refs/heads/dockerbuild-fix' }}
uses: rtCamp/action-slack-notify@master
env:
SLACK_CHANNEL: dev-houston
SLACK_COLOR: '#FF0000'
SLACK_ICON: https://avatars.slack-edge.com/2020-03-02/965719891842_db87aa21ccb61076f236_44.png
SLACK_MESSAGE: 'Stable Docker build of Codex Frontend failed :sob:'
SLACK_USERNAME: "GitHub CI"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

- name: Slack Notification
if: ${{ failure() && github.ref == 'refs/heads/develop' }}
uses: rtCamp/action-slack-notify@master
env:
SLACK_CHANNEL: dev-houston
SLACK_COLOR: '#FF0000'
SLACK_ICON: https://avatars.slack-edge.com/2020-03-02/965719891842_db87aa21ccb61076f236_44.png
SLACK_MESSAGE: 'Bleeding Edge Docker build of Codex Frontend failed :sob:'
SLACK_USERNAME: "GitHub CI"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

- name: Slack Notification
if: ${{ failure() && github.event_name == 'schedule' }}
uses: rtCamp/action-slack-notify@master
env:
SLACK_CHANNEL: dev-houston
SLACK_COLOR: '#FF0000'
SLACK_ICON: https://avatars.slack-edge.com/2020-03-02/965719891842_db87aa21ccb61076f236_44.png
SLACK_MESSAGE: 'Nightly Docker build of Codex Frontend failed :sob:'
SLACK_USERNAME: "GitHub CI"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

0 comments on commit e555bfa

Please sign in to comment.