diff --git a/.github/workflows/docker-hub-merge.yaml b/.github/workflows/docker-hub.yaml similarity index 96% rename from .github/workflows/docker-hub-merge.yaml rename to .github/workflows/docker-hub.yaml index cfd9a58..8d8c98b 100644 --- a/.github/workflows/docker-hub-merge.yaml +++ b/.github/workflows/docker-hub.yaml @@ -4,6 +4,9 @@ on: push: branches: - master + pull_request: + branches: + - master jobs: docker: @@ -97,7 +100,7 @@ jobs: - name: Set Tag run: | - if [ "${GITHUB_REF##*/}" == "master" ]; then + if [ "${{ github.event_name }}" == "push" ] && [ "${GITHUB_REF##*/}" == "master" ]; then echo "TAG=latest" >> $GITHUB_ENV else echo "TAG=beta" >> $GITHUB_ENV diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml deleted file mode 100644 index 253b406..0000000 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ /dev/null @@ -1,54 +0,0 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools - -name: Deploy to Firebase Hosting on PR -on: pull_request -permissions: - checks: write - contents: read - pull-requests: write -jobs: - build_and_preview: - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v3.0.0 - with: - versionSpec: '5.x' - - - name: Run GitVersion - id: gitversion - uses: gittools/actions/gitversion/execute@v3.0.0 - with: - useConfigFile: false - - - name: Update package version - run: | - sed -i.bak "s|\"version\": \"[0-9\.]*\"|\"version\": \"${{ steps.gitversion.outputs.semVer }}\"|" package.json - - - name: Cache UI Dependencies - id: cache_ui - uses: actions/cache@v4 - with: - path: ui/node_modules - key: ${{ runner.os }}-ui-${{ hashFiles('ui/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-ui- - - - name: Install UI dependencies - if: steps.cache_ui.outputs.cache-hit != 'true' - run: npm --prefix ui install - - - name: Build AutoML UI - run: npm --prefix ui run build - - - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: ${{ secrets.GITHUB_TOKEN }} - firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_MILO_ML }} - projectId: milo-ml diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting.yml similarity index 76% rename from .github/workflows/firebase-hosting-merge.yml rename to .github/workflows/firebase-hosting.yml index d57e1d9..74c2e7b 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting.yml @@ -1,14 +1,17 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools +name: Deploy to Firebase Hosting -name: Deploy to Firebase Hosting on merge on: push: branches: - master + pull_request: + branches: + - master + jobs: build_and_deploy: runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }} steps: - uses: actions/checkout@v4 with: @@ -45,9 +48,10 @@ jobs: - name: Build AutoML UI run: npm --prefix ui run build - - uses: FirebaseExtended/action-hosting-deploy@v0 + - name: Deploy to Firebase Hosting + uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: ${{ secrets.GITHUB_TOKEN }} firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_MILO_ML }} - channelId: live projectId: milo-ml + channelId: ${{ github.event_name == 'push' && 'live' || '' }} diff --git a/.github/workflows/python-unit-tests.yml b/.github/workflows/unit-tests.yml similarity index 97% rename from .github/workflows/python-unit-tests.yml rename to .github/workflows/unit-tests.yml index 5f6c42b..29bdc0f 100644 --- a/.github/workflows/python-unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,4 +1,4 @@ -name: Python Unit Tests +name: Unit Tests on: push: