diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..a57189d --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9d420ab..d7cd2a4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 }} \ No newline at end of file + 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 }}"}'