Skip to content

Commit

Permalink
Chore: Add backend docker build gh workflow (#81)
Browse files Browse the repository at this point in the history
* Add backend docker build github workflow
  • Loading branch information
ItamarMalka authored Jan 7, 2025
1 parent 10065fc commit c65c814
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and Push Backstage Docker Image

on:
workflow_dispatch:
inputs:
version:
description: The version to build and push
required: true
type: string
repository_dispatch:
types: [backstage_release]

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: Install Dependencies
run: yarn install --immutable

- name: Build Backend
run: |
yarn tsc:full
yarn build:all
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: bot-env0
password: ${{ secrets.GHCR_TOKEN }}

- name: Build and Push Image
uses: docker/build-push-action@v5
with:
context: ../../
file: ./packages/backend/Dockerfile
push: true
tags: |
https://ghcr.io/env0/backstage:${{ github.event.client_payload.version || github.event.inputs.version }}
https://ghcr.io/env0/backstage:latest
8 changes: 7 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,10 @@ jobs:
echo "npmAuthToken: $NODE_AUTH_TOKEN" >> ../../.yarnrc.yml
yarn workspaces foreach --all --parallel --no-private npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Trigger Docker Build
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: backstage_release
client-payload: '{"version": "${{ env.tag_version }}"}'

0 comments on commit c65c814

Please sign in to comment.