Skip to content

Commit

Permalink
condition apply for separate jobs (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
Techpurshottam authored Jun 24, 2024
2 parents 02bfb12 + 0176fd8 commit 3767231
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 51 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ jobs:
docker push ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:latest
docker push ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$IMAGE_TAG
echo "::set-output name=IMAGE::ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$IMAGE_TAG"
- name: Set build status
id: set_build_status
run: echo "::set-output name=build_status::success"
36 changes: 9 additions & 27 deletions .github/workflows/build-embed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,25 @@ name: Publish Embed to Production

on:
workflow_call:
workflow_dispatch:
secrets:
GH_PACKAGES:
required: true

jobs:
build_embed:
if: "!contains(github.event.head_commit.message, 'ci skip')"
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
environment: Production
# environment: Production
permissions:
contents: read
packages: write
deployments: write
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup kernel for react native, increase watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

- uses: actions/setup-node@v2
with:
node-version: '20.13.1'

- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.0.1
env:
CI: false
with:
version: 8.9.0
run_install: true

- name: Build
run: pnpm run --filter @impler/embed build:prod

- name: Build, tag, and push image to Github Container Registry
id: build-image
env:
Expand All @@ -61,3 +39,7 @@ jobs:
docker push ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:latest
docker push ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$IMAGE_TAG
echo "::set-output name=IMAGE::ghcr.io/$REGISTERY_OWNER/$DOCKER_NAME:$IMAGE_TAG"
- name: Set build status
id: set_build_status
run: echo "::set-output name=build_status::success"
54 changes: 30 additions & 24 deletions .github/workflows/deploy-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
# if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/api/') }}
uses: ./.github/workflows/build-api.yml
secrets: inherit
outputs:
build_status: ${{ steps.build_status.outcome == 'success' }}

build_embed:
permissions:
Expand All @@ -22,39 +24,43 @@ jobs:
deployments: write
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/demo/') }}
uses: ./.github/workflows/build-embed.yml
secrets: inherit
outputs:
build_status: ${{ steps.build_status.outcome == 'success' }}

build_queuemanager:
permissions:
contents: read
packages: write
deployments: write
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/queue-manager/') }}
uses: ./.github/workflows/build-queuemanager.yml
# build_queuemanager:
# permissions:
# contents: read
# packages: write
# deployments: write
# if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/queue-manager/') }}
# uses: ./.github/workflows/build-queuemanager.yml

build_web:
permissions:
contents: read
packages: write
deployments: write
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/web/') }}
uses: ./.github/workflows/build-web.yml
# build_web:
# permissions:
# contents: read
# packages: write
# deployments: write
# if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/web/') }}
# uses: ./.github/workflows/build-web.yml

build_widget:
permissions:
contents: read
packages: write
deployments: write
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/widget/') }}
uses: ./.github/workflows/build-widget.yml
# build_widget:
# permissions:
# contents: read
# packages: write
# deployments: write
# if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/widget/') }}
# uses: ./.github/workflows/build-widget.yml

deploy_with_ssh:
runs-on: ubuntu-latest
needs:
- build_api
- build_embed
- build_queuemanager
- build_web
- build_widget
# - build_queuemanager
# - build_web
# - build_widget
if: needs.build_api.outputs.build_status == 'true' || needs.build_embed.outputs.build_status == 'true'
steps:
- name: Set up SSH and Run Docker Compose Up
uses: webfactory/ssh-agent@v0.5.3
Expand Down

0 comments on commit 3767231

Please sign in to comment.