Skip to content

Commit

Permalink
Merge pull request #1927 from opengovern/ui-changes
Browse files Browse the repository at this point in the history
feat: workflows
  • Loading branch information
mohamadch91 authored Nov 11, 2024
2 parents ca55914 + 0893c7c commit debcf41
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
environment: golang
outputs:
latest_tag: ${{ steps.set_latest_tag.outputs.latest_tag }}
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event.pull_request.head.ref != 'ui-changes'
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
41 changes: 25 additions & 16 deletions .github/workflows/ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ on:
default: "dev"
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ] # This will trigger on PRs targeting the `main` branch

jobs:
build:
if: ${{ github.event.pull_request.head.ref == 'ui-changes' || github.event_name != 'pull_request' }}
environment: web
runs-on: ubuntu-latest
permissions:
Expand All @@ -35,7 +38,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: NPM Cache
uses: actions/cache@v3
with:
Expand All @@ -46,36 +49,42 @@ jobs:
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Go To Code directory
run : cd services/web-ui
- name: check dir
run : ls

- name: Install dependencies
- name: Go to Code Directory
working-directory: services/web-ui
run: |
echo "Navigating to code directory..."
pwd
ls
- name: Install Dependencies
run: npm install
working-directory: services/web-ui

- name: Build
env:
CI: false
run: npm run build
working-directory: services/web-ui

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1

- name: Log in to the Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and push Docker images

- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
context: .
context: ./services/web-ui
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64 # Add multi-platform support

tags:
ghcr.io/${{ github.repository_owner }}/web-ui:${{ steps.tag_version.outputs.new_tag }}-${{ github.event.inputs.deployTo == '' && 'dev' || github.event.inputs.deployTo }}
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository_owner }}/web-ui:${{ steps.tag_version.outputs.new_tag }}-${{ github.event.inputs.deployTo || 'dev' }}
file: docker/WebUiDockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max

0 comments on commit debcf41

Please sign in to comment.