diff --git a/.github/workflows/auto-check-new-releases.yml b/.github/workflows/auto-check-new-releases.yml index 980722b..f4dc42f 100644 --- a/.github/workflows/auto-check-new-releases.yml +++ b/.github/workflows/auto-check-new-releases.yml @@ -1,3 +1,5 @@ +# .github/workflows/auto-check-new-releases.yml + ################### # ENV VARS: # # - FULL_NAME @@ -6,8 +8,18 @@ ################### name: Check for new releases -# Automatically check for new releases (new versions) on: + workflow_dispatch: + inputs: + version: + description: "N8N version (leave empty to use latest)" + required: false + type: string + use_latest: + description: "Use latest N8N version" + required: false + default: true + type: boolean schedule: - cron: "0 0 */1 * *" @@ -17,24 +29,47 @@ jobs: steps: - uses: actions/checkout@v2 with: - token: ${{ secrets.PAT }} - - name: Fetch release version - id: fetch-version + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get latest stable N8N version from GitHub API + id: get-latest + run: | + # Fetch all releases and filter for stable versions only (not pre-release) + LATEST_VERSION=$(curl -s https://api.github.com/repos/n8n-io/n8n/releases | \ + jq -r '.[] | select(.prerelease == false) | .tag_name' | \ + head -1 | \ + sed 's/^n8n@//') + + if [ -z "$LATEST_VERSION" ]; then + echo "Error: Could not fetch latest stable version" + exit 1 + fi + + echo "latest_version=${LATEST_VERSION}" >> $GITHUB_OUTPUT + echo "Latest stable N8N version: ${LATEST_VERSION}" + + - name: Determine version to use + id: determine-version run: | - curl -sL https://raw.githubusercontent.com/n8n-io/n8n/master/package.json | jq -r ".version" > release-versions/n8n-latest.txt - echo ::set-output name=version::$(cat release-versions/n8n-latest.txt) - - # - name: Check for modified files - # id: git-check - # run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") - # - name: Commit latest release version - # if: steps.git-check.outputs.modified == 'true' - # run: | - # git config --global user.name '${{ secrets.FULL_NAME }}' - # git config --global user.email '${{ secrets.EMAIL }}' - # git commit -am "New release: $(cat release-versions/n8n-latest.txt)" - # git push + echo "Event name: ${{ github.event_name }}" + echo "Input use_latest: '${{ github.event.inputs.use_latest }}'" + echo "Input version: '${{ github.event.inputs.version }}'" + + # For scheduled runs, inputs are not available, so default to latest + if [[ "${{ github.event_name }}" == "schedule" ]]; then + VERSION="${{ steps.get-latest.outputs.latest_version }}" + echo "Scheduled run - using latest version: ${VERSION}" + elif [[ "${{ github.event.inputs.use_latest }}" == "true" || -z "${{ github.event.inputs.version }}" ]]; then + VERSION="${{ steps.get-latest.outputs.latest_version }}" + echo "Manual run - using latest version: ${VERSION}" + else + VERSION="${{ github.event.inputs.version }}" + echo "Manual run - using specified version: ${VERSION}" + fi + + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "${VERSION}" > release-versions/n8n-latest.txt - uses: stefanzweifel/git-auto-commit-action@v4 with: - commit_message: New auto release v${{steps.fetch-version.outputs.version}} \ No newline at end of file + commit_message: "New release ${{ steps.determine-version.outputs.version }}" diff --git a/.github/workflows/docker-images-local-test.yml b/.github/workflows/docker-images-local-test.yml new file mode 100644 index 0000000..26ba1d8 --- /dev/null +++ b/.github/workflows/docker-images-local-test.yml @@ -0,0 +1,38 @@ +########### +# Local test workflow to reproduce build failures +# Skips Docker Hub login and push operations +########### + +name: Docker Image CI - Local Test + +on: + push: + paths: + - "release-versions/*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Get current repository + uses: actions/checkout@v1 + - name: Get the version + id: vars + run: echo ::set-output name=tag::$(cat release-versions/n8n-latest.txt) + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - run: cp default-requirements.txt images/n8n/requirements.txt + - name: Build (default => alpine) - LOCAL TEST + uses: docker/build-push-action@v2 + with: + context: ./images/n8n + build-args: | + N8N_VERSION=${{steps.vars.outputs.tag}} + platforms: linux/amd64 + push: false # Skip push for local testing + tags: | + local-test/n8n-python:${{ steps.vars.outputs.tag }} + local-test/n8n-python:latest diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 0b0fdaf..6508439 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -1,3 +1,5 @@ +# .github/workflows/docker-images.yml + ########### # ENV VARS: # - DOCKER_USERNAME @@ -10,7 +12,8 @@ name: Docker Image CI on: push: paths: - - 'release-versions/*' + - "release-versions/*" + workflow_dispatch: jobs: build: @@ -51,7 +54,7 @@ jobs: context: ./images/n8n-debian build-args: | N8N_VERSION=${{ steps.vars.outputs.tag }} - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: linux/amd64,linux/arm64 push: true tags: | ${{ secrets.DOCKER_USERNAME }}/n8n-python:${{ steps.vars.outputs.tag }}-debian @@ -62,7 +65,7 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - repository: naskio/n8n-python + repository: sharmarahul0810/n8n-python readme-filepath: README.md - name: Create Release in GitHub @@ -74,4 +77,4 @@ jobs: with: tag_name: v${{steps.vars.outputs.tag}} release_name: Release ${{steps.vars.outputs.tag}} - body: n8n v${{steps.vars.outputs.tag}} (python3 included) \ No newline at end of file + body: n8n v${{steps.vars.outputs.tag}} (python3 included) diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml deleted file mode 100644 index c50f7d4..0000000 --- a/.github/workflows/manual-release.yml +++ /dev/null @@ -1,40 +0,0 @@ -################### -# ENV VARS: -# - PAT (generated at Personal Access Tokens - with workflow access checked) -################### - -name: Create new release manually - -on: - workflow_dispatch: - inputs: - version: - description: 'version' - required: true - default: '0.179.0' - type: string - -jobs: - get-version: - runs-on: ubuntu-latest - steps: - - - uses: actions/checkout@v2 - with: - token: ${{ secrets.PAT }} - - ## if we prefer without an input - # - name: Fetch release version - # id: fetch-version - # run: | - # curl -sL https://raw.githubusercontent.com/n8n-io/n8n/master/package.json | jq -r ".version" > release-versions/n8n-latest.txt - # echo ::set-output name=version::$(cat release-versions/n8n-latest.txt) - - - name: Fetch release version - id: fetch-version - run: | - echo "${{ github.event.inputs.version }}" > release-versions/n8n-latest.txt - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: New manual release ${{ github.event.inputs.version }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index a289f79..5284521 100644 --- a/.gitignore +++ b/.gitignore @@ -178,4 +178,7 @@ Temporary Items # Others *.tmp.* *.tmp -n8n_data/ \ No newline at end of file +n8n_data/ + +# act (GitHub Actions local runner) configuration +.secrets \ No newline at end of file diff --git a/README.md b/README.md index d60083e..6b3c298 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ ![n8n.io - Workflow Automation](https://raw.githubusercontent.com/n8n-io/n8n/master/assets/n8n-logo.png) -This [image](https://hub.docker.com/r/naskio/n8n-python) includes Python 3.10 by default. it can be used to run python +This [image](https://hub.docker.com/r/sharmarahul0810/n8n-python) includes Python 3.12 by default. it can be used to run python scripts inside n8n using the [Execute Command](https://docs.n8n.io/nodes/n8n-nodes-base.executeCommand/) node or code snippets using the custom node [Python Function](https://www.github.com/naskio/n8n-nodes-python). > Run python 3.10 code on n8n. -[Docker Hub](https://hub.docker.com/r/naskio/n8n-python) +[Docker Hub](https://hub.docker.com/r/sharmarahul0810/n8n-python) [GitHub repository](https://www.github.com/naskio/docker-n8n-python) @@ -49,4 +49,4 @@ The official n8n documentation can be found under: [https://docs.n8n.io](https:/ Additional information and example workflows on the n8n.io website: [https://n8n.io](https://n8n.io) -Learn [how to run n8n in **Docker**](https://github.com/n8n-io/n8n/tree/master/docker/images/n8n/README.md) \ No newline at end of file +Learn [how to run n8n in **Docker**](https://github.com/n8n-io/n8n/tree/master/docker/images/n8n/README.md) diff --git a/demo/docker-compose-local.yml b/demo/docker-compose-local.yml index 1da36f6..197c158 100644 --- a/demo/docker-compose-local.yml +++ b/demo/docker-compose-local.yml @@ -1,9 +1,9 @@ -version: '3.8' +version: "3.8" services: n8n-python: - image: naskio/n8n-python:latest-debian # use this if intended to use heavy python packages - # image: naskio/n8n-python # alpine for light python packages + image: sharmarahul0810/n8n-python:latest-debian # use this if intended to use heavy python packages + # image: sharmarahul0810/n8n-python # alpine for light python packages # command: /bin/sh -c "n8n start" restart: always container_name: n8n-python @@ -16,4 +16,4 @@ services: - ./n8n_data:/home/node/.n8n - ./local-files:/data/files # by default workdir == /data - ./python_scripts:/data/py_scripts - - ./requirements.txt:/data/requirements.txt \ No newline at end of file + - ./requirements.txt:/data/requirements.txt diff --git a/demo/docker-compose.yml b/demo/docker-compose.yml index 3695762..f41e97f 100644 --- a/demo/docker-compose.yml +++ b/demo/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: n8n-python: - image: naskio/n8n-python + image: sharmarahul0810/n8n-python # command: /bin/sh -c "sleep 5; n8n start" # Wait 5 seconds to start n8n to make sure that PostgreSQL is ready restart: always container_name: n8n-python @@ -47,4 +47,4 @@ networks: auto-reverse-proxy-global-network: external: true postgres_service-network: - external: true \ No newline at end of file + external: true diff --git a/images/n8n-debian/Dockerfile b/images/n8n-debian/Dockerfile index f44e3eb..411aaca 100644 --- a/images/n8n-debian/Dockerfile +++ b/images/n8n-debian/Dockerfile @@ -1,4 +1,4 @@ -FROM nikolaik/python-nodejs:python3.10-nodejs24 +FROM nikolaik/python-nodejs:python3.12-nodejs20 # changing user `pn` to `node` RUN usermod --login node --move-home --home /home/node pn @@ -23,10 +23,16 @@ USER root RUN npm_config_user=root npm install -g full-icu n8n@${N8N_VERSION} -# Install n8n-nodes-python module -RUN cd /usr/lib/node_modules/n8n && npm install n8n-nodes-python +# Install n8n-nodes-python module with legacy peer deps to resolve dependency conflicts +RUN N8N_PATH=$(find /usr -name "n8n" -type d -path "*/node_modules/n8n" 2>/dev/null | head -1) && \ + if [ -n "$N8N_PATH" ] && [ -d "$N8N_PATH" ]; then \ + echo "Found n8n at: $N8N_PATH" && \ + cd "$N8N_PATH" && npm install n8n-nodes-python --legacy-peer-deps; \ + else \ + echo "Error: n8n directory not found in node_modules" && exit 1; \ + fi -ENV NODE_ICU_DATA /usr/lib/node_modules/full-icu +ENV NODE_ICU_DATA=/usr/lib/node_modules/full-icu WORKDIR /data diff --git a/images/n8n/Dockerfile b/images/n8n/Dockerfile index f819f3c..875c544 100644 --- a/images/n8n/Dockerfile +++ b/images/n8n/Dockerfile @@ -1,4 +1,4 @@ -FROM nikolaik/python-nodejs:python3.10-nodejs24-alpine +FROM nikolaik/python-nodejs:python3.12-nodejs20-alpine # changing user `pn` to `node` RUN deluser pn && rm -r /home/pn # delete: user + group @@ -21,8 +21,14 @@ RUN apk --update add --virtual build-dependencies build-base ca-certificates && apk del build-dependencies \ && rm -rf /root /tmp/* /var/cache/apk/* && mkdir /root; -# Install n8n-nodes-python module -RUN cd /usr/local/lib/node_modules/n8n && npm install n8n-nodes-python +# Install n8n-nodes-python module with legacy peer deps to resolve dependency conflicts +RUN N8N_PATH=$(find /usr -name "n8n" -type d -path "*/node_modules/n8n" 2>/dev/null | head -1) && \ + if [ -n "$N8N_PATH" ] && [ -d "$N8N_PATH" ]; then \ + echo "Found n8n at: $N8N_PATH" && \ + cd "$N8N_PATH" && npm install n8n-nodes-python --legacy-peer-deps; \ + else \ + echo "Error: n8n directory not found in node_modules" && exit 1; \ + fi # Install fonts RUN apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \ @@ -46,7 +52,7 @@ COPY requirements.txt /requirements/requirements.txt RUN python -m pip install --upgrade pip setuptools wheel RUN pip install -r /requirements/requirements.txt -ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu +ENV NODE_ICU_DATA=/usr/local/lib/node_modules/full-icu WORKDIR /data diff --git a/release-versions/n8n-latest.txt b/release-versions/n8n-latest.txt index 1916b6b..bda8fbe 100644 --- a/release-versions/n8n-latest.txt +++ b/release-versions/n8n-latest.txt @@ -1 +1 @@ -1.110.0 +2.2.6