Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js & cache npm
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: npm install --frozen-lockfile

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artifact left by pnpm, should probably unify to npm ci xd


- name: Lint code
run: npm run lint

- name: Type-check
run: npx tsc --noEmit

- name: Build project
run: npm run build
79 changes: 79 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Release & Publish Apify n8n Node

on:
release:
types: [published]

jobs:
build_and_release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
fetch-depth: 0

- name: Setup Node.js and cache npm
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Run tests
run: npm test

- name: Configure Git
run: |
git config --global user.name "Apify Release Bot"
git config --global user.email "noreply@apify.com"

- name: Extract release version
id: get_version
run: |
FULL_TAG_NAME="${{ github.event.release.tag_name }}"
VERSION_NUMBER="${FULL_TAG_NAME#v}"
echo "VERSION=${VERSION_NUMBER}" >> $GITHUB_ENV

- name: Update package.json version
run: |
echo "Updating package.json to version ${{ env.VERSION }}"
npm version ${{ env.VERSION }} --no-git-tag-version

- name: Commit version update
run: |
git add package.json package-lock.json
if ! git diff --staged --quiet; then
TARGET_BRANCH="${{ github.event.release.target_commitish }}"
echo "Target branch for push: $TARGET_BRANCH"
git commit -m "chore(release): set version to ${{ env.VERSION }} [skip ci]"
echo "Pushing version update to branch: $TARGET_BRANCH"
git push origin HEAD:"refs/heads/$TARGET_BRANCH"
else
echo "No changes to commit in package.json or package-lock.json for version update."
fi
env:
GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

- name: Set up npm authentication
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}" > ~/.npmrc

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}
run: |
if npm view @apify/n8n-nodes-apify-actor-template@${{ env.VERSION }} version > /dev/null 2>&1; then
echo "Version ${{ env.VERSION }} of @apify/n8n-nodes-apify-actor-template is already published to npm. Skipping publish step."
else
echo "Publishing @apify/n8n-nodes-apify-actor-template@${{ env.VERSION }} to npm..."
npm publish --access public
fi