Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add gyp-next updater #3105

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 2 additions & 3 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ jobs:
release-please:
outputs:
release_created: ${{ steps.release.outputs.release_created }}
permissions:
contents: write # to create release commit (googleapis/release-please-action)
pull-requests: write # to create release PR (googleapis/release-please-action)
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GH_USER_TOKEN }}
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved
# Standard Conventional Commits: `feat` and `fix`
# node-gyp subdirectories: `bin`, `gyp`, `lib`, `src`, `test`
# node-gyp subcommands: `build`, `clean`, `configure`, `install`, `list`, `rebuild`, `remove`
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/update-gyp-next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Update gyp-next

on:
schedule:
# Run once a week at 12:00 AM UTC on Sunday.
- cron: 0 0 * * *
workflow_dispatch:

permissions:
contents: read

env:
NODE_VERSION: lts/*

jobs:
update-gyp-next:
# if: github.repository == 'nodejs/node' || github.event_name == 'workflow_dispatch'
legendecas marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: actions/github-script@v7
id: get-gyp-next-version
with:
script: |
const result = await github.rest.repos.getLatestRelease({
owner: 'nodejs',
repo: 'gyp-next',
});
return result.data.tag_name
result-encoding: string

- name: Update gyp-next
run: |
python update-gyp.py --no-commit ${{ steps.get-gyp-next-version.outputs.result }}

- name: Open or update PR for the gyp-next update
uses: gr2m/create-or-update-pull-request-action@v1
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved
with:
branch: actions/update-gyp-next
author: Node.js GitHub Bot <github-bot@iojs.org>
title: 'feat: update gyp-next to ${{ steps.get-gyp-next-version.outputs.result }}'
commit-message: 'feat: update gyp-next to ${{ steps.get-gyp-next-version.outputs.result }}'
update-pull-request-title-and-body: true
body: >
This is an automated update of the gyp-next to
https://github.com/nodejs/gyp-next/releases/tag/${{ steps.get-gyp-next-version.outputs.result }}.
env:
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 7 additions & 2 deletions update-gyp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
CHECKOUT_GYP_PATH = os.path.join(CHECKOUT_PATH, "gyp")

parser = argparse.ArgumentParser()
parser.add_argument("--no-commit",
action="store_true",
dest="no_commit",
help="do not run git-commit")
parser.add_argument("tag", help="gyp tag to update to")
args = parser.parse_args()

Expand Down Expand Up @@ -60,5 +64,6 @@
os.path.join(unzip_target, os.listdir(unzip_target)[0]), CHECKOUT_GYP_PATH
)

subprocess.check_output(["git", "add", "gyp"], cwd=CHECKOUT_PATH)
subprocess.check_output(["git", "commit", "-m", "feat(gyp): update gyp to " + args.tag])
if not args.no_commit:
subprocess.check_output(["git", "add", "gyp"], cwd=CHECKOUT_PATH)
subprocess.check_output(["git", "commit", "-m", "feat(gyp): update gyp to " + args.tag])

Check failure on line 69 in update-gyp.py

View workflow job for this annotation

GitHub Actions / Lint Python

Ruff (E501)

update-gyp.py:69:89: E501 Line too long (90 > 88)
legendecas marked this conversation as resolved.
Show resolved Hide resolved
Loading