From eb029e9967053cdb95880a936021ef1d0b0b15e3 Mon Sep 17 00:00:00 2001 From: "Hamster [bot]" Date: Thu, 19 Sep 2024 09:49:28 +0530 Subject: [PATCH] Hamster Left A Pull Request - (Update deploy.yml) (#228) * Update deploy.yml * CI Upgrades. * Update mirror.yml --------- Co-authored-by: Vedansh --- .devcontainer/Dockerfile | 4 ++-- .github/dependabot.yml | 26 +++++++++++++++++++--- .github/workflows/build-and-test.yml | 6 ++--- .github/workflows/deploy.yml | 33 ++++++++++++++++++---------- .github/workflows/docker-image.yml | 4 ++-- .github/workflows/docker-publish.yml | 18 ++++++++++----- .github/workflows/mirror.yml | 2 +- .github/workflows/pr-bot.yml | 2 +- Dockerfile | 4 ++-- 9 files changed, 68 insertions(+), 31 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6fef30d3..3992df8b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -20,7 +20,7 @@ RUN apt-get update && \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -RUN npm i -g pnpm +RUN npm i -g pnpm@9.0.0 WORKDIR /usr/src/app COPY package*.json ./ RUN npm install --frozen-lockfile @@ -29,4 +29,4 @@ COPY . . RUN chown -R user:user /usr/src/app USER user EXPOSE 7777 -CMD ["npm", "run", "start"] \ No newline at end of file +CMD ["pnpm", "run", "start"] \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index daee875b..9be9f022 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,26 @@ version: 2 updates: - - package-ecosystem: "npm" - directory: "/" + - package-ecosystem: github-actions + directory: / schedule: - interval: "weekly" + interval: weekly + groups: + actions-minor: + update-types: + - minor + - patch + + - package-ecosystem: npm + directory: / + schedule: + interval: weekly + groups: + npm-development: + dependency-type: development + update-types: + - minor + - patch + npm-production: + dependency-type: production + update-types: + - patch \ No newline at end of file diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 673c93d7..df388ee8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -21,7 +21,7 @@ jobs: matrix: node-version: [18.x, 19.x, 20.x, 21.x, 22.x] - name: Linux - Build & Test on Node Version ${{ matrix.node-version }} + name: Linux - Build & Test on v${{ matrix.node-version }} steps: - uses: actions/checkout@v4 @@ -44,7 +44,7 @@ jobs: matrix: node-version: [18.x, 19.x, 20.x, 21.x, 22.x] - name: Macos - Build & Test on Node Version ${{ matrix.node-version }} + name: Macos - Build & Test on v${{ matrix.node-version }} steps: - uses: actions/checkout@v4 @@ -67,7 +67,7 @@ jobs: matrix: node-version: [18.x, 19.x, 20.x, 21.x, 22.x] - name: Windows - Build & Test on Node Version ${{ matrix.node-version }} + name: Windows - Build & Test on v${{ matrix.node-version }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c14025ac..d0bc1b0b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,21 +1,23 @@ name: CI / Deploy to GHCR on: - schedule: - - cron: '0 0 * * 0' push: tags: - '*' + schedule: + - cron: '0 0 1 * *' workflow_dispatch: env: + USERNAME: ${{ github.repository_owner }} REGISTRY: ghcr.io - USER: ${{ github.repository_owner }} IMAGE_NAME: ${{ github.repository }} - TOKEN: ${{ secrets.GITHUB_TOKEN }} + PASSPRHASE: ${{ secrets.GITHUB_TOKEN || secrets.BOT_TOKEN }} + jobs: - build-and-push-image: - runs-on: macos-latest + deploy: + runs-on: ubuntu-latest + timeout-minutes: 30 permissions: contents: read packages: write @@ -24,21 +26,28 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Log in to the Container Registry + - name: Login to the Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ env.USERNAME }} + password: ${{ env.PASSPRHASE }} - - name: Extract Metadata (tags, labels) for Docker + - name: Extract Metadatafor Docker id: meta uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v3 + - name: Verify Tags and Labels + run: | + echo "## Github Action Summary - Docker CI " >> $GITHUB_STEP_SUMMARY + echo "Tags: ${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY + echo "Labels: ${{ steps.meta.outputs.labels }} " >> $GITHUB_STEP_SUMMARY + echo "*** VERIFICATION COMPLETED ***" >> $GITHUB_STEP_SUMMARY + + - name: Build and Push Image + uses: docker/build-push-action@v4 with: context: . push: true diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index cfbab4bb..f5348542 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -4,9 +4,9 @@ on: schedule: - cron: '0 */1 * * *' push: - branches: [ "master", "*" ] + branches: [ "master", "**" ] pull_request: - branches: [ "master", "*" ] + branches: [ "master", "**" ] workflow_dispatch: jobs: diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 48da7493..91ee9eb1 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -8,7 +8,8 @@ on: env: REGISTRY: docker.io IMAGE_NAME: ${{ secrets.DOCKER_USER }}/${{ secrets.DOCKER_IMAGE }} - + USERNAME: ${{ secrets.DOCKER_USER }} + PASSWORD: ${{ secrets.DOCKER_TOKEN }} jobs: push: runs-on: ubuntu-latest @@ -29,13 +30,13 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 - - name: Log into registry ${{ env.REGISTRY }} + - name: Login to Registry ${{ env.REGISTRY }} if: github.event_name != 'pull_request' uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 with: registry: ${{ env.REGISTRY }} - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_TOKEN }} + username: ${{ env.USERNAME }} + password: ${{ env.PASSWORD }} - name: Extract Docker Metadata id: meta @@ -43,6 +44,13 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Verify Tags and Labels + run: | + echo "## Github Action Summary - Docker CI " >> $GITHUB_STEP_SUMMARY + echo "Tags: ${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY + echo "Labels: ${{ steps.meta.outputs.labels }} " >> $GITHUB_STEP_SUMMARY + echo "*** VERIFICATION COMPLETED ***" >> $GITHUB_STEP_SUMMARY + - name: Build and Push Docker Image id: build-and-push uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 @@ -59,4 +67,4 @@ jobs: env: TAGS: ${{ steps.meta.outputs.tags }} DIGEST: ${{ steps.build-and-push.outputs.digest }} - run: echo "Image with ${TAGS} tag has been sucessfully Signed." + run: echo "Image with ${TAGS} tag has been sucessfully Signed." \ No newline at end of file diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 589d29cf..b70017af 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -11,7 +11,7 @@ jobs: timeout-minutes: 10 name: Gitlab Repo Sync steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: wangchucheng/git-repo-sync@v0.1.0 diff --git a/.github/workflows/pr-bot.yml b/.github/workflows/pr-bot.yml index f1d22985..3d6757ad 100644 --- a/.github/workflows/pr-bot.yml +++ b/.github/workflows/pr-bot.yml @@ -47,7 +47,7 @@ jobs: ## This Pull Request Was Automated by [Hamster [bot]](https://github.com/TheHamsterBot) > [!NOTE] - > Workflow Trigger: ${{ github.event_name }} event at ${{ github.action_ref }} . + > Workflow Trigger: ${{ github.event_name }} event ${{ github.action_ref }} . > Details of Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - Author: @TheHamsterBot diff --git a/Dockerfile b/Dockerfile index 4f89ba5f..8be0d452 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ RUN pnpm run install COPY --chown=node:node . . # Build TypeScript files using tsup (for bundling) -RUN npm run build +RUN pnpm run build # Set proper file ownership and permissions RUN chown -R node:node /usr/src/app @@ -40,6 +40,6 @@ USER node EXPOSE ${PORT} # Command to start the application -CMD ["npm","start"] +CMD ["pnpm","start"] # syntax=docker/dockerfile:END \ No newline at end of file