Refactor UI to use local state for pipeline / status change tracking #49
This file contains 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: Docker Images | |
on: | |
push: | |
branches: ['main'] | |
paths-ignore: | |
- '**/*.md' # Ignore changes to markdown files | |
release: | |
types: [created] | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
environment: Github CI | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install bun for deployment | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
# Login against a Docker registry | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Conditional tagging based on the event type (main push or release) | |
- name: Determine image tags | |
id: tags | |
run: | | |
if [[ "${{ github.event_name }}" == "release" ]]; then | |
# Tag as `latest` and `vX.X.X` for releases | |
echo "TAGS=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}" >> $GITHUB_ENV | |
else | |
# Tag as `nightly` for pushes to main | |
echo "TAGS=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly" >> $GITHUB_ENV | |
fi | |
shell: bash | |
# Build and push Docker image with Buildx | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: ${{ env.TAGS }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# deploy nightly | |
- name: Deploy docker image to staging | |
if: ${{ github.event_name != 'release' }} | |
env: | |
EXO_TOKEN: ${{ secrets.EXO_TOKEN }} | |
run: bunx exoframe -u -c exoframe-nightly.json -e https://exoframe.codezen.net -t $EXO_TOKEN | |
# deploy to prod | |
- name: Deploy docker image to production | |
if: ${{ github.event_name == 'release' }} | |
env: | |
EXO_TOKEN: ${{ secrets.EXO_TOKEN }} | |
run: bunx exoframe -u -e https://exoframe.codezen.net -t $EXO_TOKEN |