diff --git a/.github/workflows/auto-comment.yml b/.github/workflows/auto-comment.yml index 6efc55b7d..7230c4dbb 100644 --- a/.github/workflows/auto-comment.yml +++ b/.github/workflows/auto-comment.yml @@ -1,37 +1,56 @@ -name: 👋 Auto Comment -on: [issues, pull_request] +name: 💬 Auto Comment + +on: + issues: + types: [opened] + pull_request: + types: [opened, closed] + jobs: - run: + auto_comment: runs-on: ubuntu-latest steps: - - uses: bubkoo/auto-comment@v1.1.2 + - name: 🤖 Auto Comment on Issues and PRs + uses: actions/github-script@v7 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - issuesOpened: > - 👋 Hi @{{ author }}, - - Issues is only for reporting a bug/feature request. Please read documentation before raising an issue https://rengine.wiki - - For very limited support, questions, and discussions, please join reNgine Discord channel: https://discord.gg/azv6fzhNCE - - Please include all the requested and relevant information when opening a bug report. Improper reports will be closed without any response. - - pullRequestOpened: > - 👋 Hi @{{ author }}, - - Thank you for sending this pull request. - - Please make sure you have followed our [contribution guidelines](https://github.com/yogeshojha/rengine/blob/master/.github/CONTRIBUTING.md). - - We will review this PR as soon as possible. Thank you for your patience. - - pullRequestClosed: > - 🚀 Hi @{{ author }}, - - You are amazing! Thank you for your contributions. Your contributions are what makes reNgine awesome! - - This pull request has now been closed. - - We look forward to your more contributions and support. - - Thanks + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const { owner, repo } = context.repo; + const author = context.payload.sender.login; + + if (context.eventName === 'issues' && context.payload.action === 'opened') { + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner, + repo, + body: `Hey @${author}! 👋 Thanks for flagging this! 🐛🐞 + + Before we dig in, Let's make sure you have + + 🔍 Gone through the documentation: https://rengine.wiki + 🕵️ Make sure it's not a known issue + 📝 Provided us all the details related to this bug` + }); + } else if (context.eventName === 'pull_request' && context.payload.action === 'opened') { + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner, + repo, + body: `Woohoo @${author}! 🎉 You've just dropped some hot new code! 🔥 + + Hang tight while we review this! You rock! 🤘` + }); + } else if (context.eventName === 'pull_request' && context.payload.action === 'closed') { + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner, + repo, + body: `Holy smokes, @${author}! 🤯 You've just made reNgine even more awesome! + + Your code is now part of the reNgine hall of fame. 🏆 + + Keep the cool ideas coming - maybe next time you'll break the internet! 💻💥 + + Virtual high fives all around! 🙌` + }); + } \ No newline at end of file diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index eb9feec1d..d5cdad0b7 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -1,4 +1,4 @@ -name: 🌄 Build Docker image for pull request +name: 🏗️ Build Docker image for pull request on: pull_request: @@ -8,33 +8,42 @@ on: jobs: build: - name: Build Docker image + name: 🐳 Build Docker image runs-on: ubuntu-latest strategy: matrix: platform: - linux/amd64 - linux/arm64 + # - linux/arm/v7 steps: - - name: Checkout the git repo + - name: 📥 Checkout the git repo uses: actions/checkout@v4 - - name: Log in to Docker Hub - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + - name: 🖥️ Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: 🏗️ Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Extract metadata (tags, labels) for Docker + - name: 🏷️ Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: yogeshojha/rengine + tags: | + type=raw,value=pr-${{ github.event.pull_request.number }} + type=sha,prefix=sha- + type=ref,event=branch + type=ref,event=pr - - name: Build Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + - name: 🏗️ Build Docker image + uses: docker/build-push-action@v5 with: context: web/ + platforms: ${{ matrix.platform }} push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd438d55d..df11eb559 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,16 @@ -name: Build Docker image +name: 🚀 Build and Push Docker image on: push: branches: [ master ] + release: + types: [published] schedule: - - cron: '0 18 * * 5' + - cron: '0 0 */5 * *' # Run every 5 days at midnight UTC jobs: - build: - name: Build Docker image + build-and-push: + name: 🐳 Build and Push Docker image runs-on: ubuntu-latest strategy: matrix: @@ -16,25 +18,41 @@ jobs: - linux/amd64 - linux/arm64 steps: - - name: Checkout the git repo + - name: 📥 Checkout the git repo uses: actions/checkout@v4 - - name: Log in to Docker Hub - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + - name: 🖥️ Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: 🛠️ Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: 🔑 Log in to Docker Hub + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Extract metadata (tags, labels) for Docker + - name: 🏷️ Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: yogeshojha/rengine + tags: | + type=raw,value=${{ matrix.platform }}-latest,enable={{is_default_branch}} + type=semver,pattern=${{ matrix.platform }}-{{version}} + type=semver,pattern=${{ matrix.platform }}-{{major}}.{{minor}} + type=semver,pattern=${{ matrix.platform }}-{{major}} + type=sha,prefix=${{ matrix.platform }}-sha- + type=schedule,pattern=${{ matrix.platform }}-{{date 'YYYYMMDD'}} - - name: Build Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + - name: 🏗️ Build and push Docker image + uses: docker/build-push-action@v5 with: context: web/ - push: true + platforms: ${{ matrix.platform }} + push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/web/Dockerfile b/web/Dockerfile index 575e43077..33dd9ee86 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -56,9 +56,7 @@ RUN apt install -y --no-install-recommends \ RUN add-apt-repository ppa:mozillateam/ppa RUN ARCH=$(dpkg --print-architecture) \ - && wget https://go.dev/dl/go${GOVERSION}.linux-${ARCH}.tar.gz \ - && tar -xvf go${GOVERSION}.linux-${ARCH}.tar.gz -C /usr/local \ - && rm go${GOVERSION}.linux-${ARCH}.tar.gz + && curl -L https://go.dev/dl/go${GOVERSION}.linux-${ARCH}.tar.gz | tar -xzC /usr/local RUN ARCH=$(dpkg --print-architecture) \ && if [ "${ARCH}" = "arm64" ]; then \ @@ -72,7 +70,7 @@ RUN ARCH=$(dpkg --print-architecture) \ && mv geckodriver /usr/bin # Install Rust for orjson -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +RUN set -e; curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" RUN pip3 install maturin