Skip to content

Commit bcbc6bd

Browse files
committed
create auto docs update
1 parent a0ebdc9 commit bcbc6bd

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Bump docs.arduino.cc Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
target_version:
7+
description: 'Target version to bump to. Leave blank to use the latest version.'
8+
required: false
9+
type: string
10+
11+
jobs:
12+
bump_version:
13+
runs-on: ubuntu-latest
14+
env:
15+
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: 'npm'
25+
26+
- name: Configure Git
27+
run: |
28+
git config user.name "github-actions[bot]"
29+
git config user.email "github-actions[bot]@users.noreply.github.com"
30+
31+
- name: Determine version to install
32+
id: get_version
33+
env:
34+
NPM_CONFIG_USERCONFIG: ${{ github.workspace }}/.npmrc
35+
NODE_AUTH_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
36+
run: |
37+
VERSION="${{ github.event.inputs.target_version }}"
38+
if [ -z "$VERSION" ]; then
39+
echo "No target_version provided. Finding the latest version..."
40+
LATEST_VERSION=$(npm view @arduino/docs.arduino.cc version)
41+
echo "Latest version is $LATEST_VERSION"
42+
echo "version=$LATEST_VERSION" >> "$GITHUB_OUTPUT"
43+
else
44+
echo "Using target version: $VERSION"
45+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
46+
fi
47+
48+
- name: Update package.json files
49+
env:
50+
VERSION: ${{ steps.get_version.outputs.version }}
51+
run: |
52+
find . -name "package.json" -exec sed -i 's/@arduino\/docs-arduino-cc": "^.*"/@arduino\/docs-arduino-cc": "^'${VERSION}'"/' {} \;
53+
54+
- name: Install dependencies with pnpm
55+
run: npm install
56+
57+
- name: Create Pull Request
58+
uses: peter-evans/create-pull-request@v6
59+
with:
60+
token: ${{ secrets.BUMP_DOCS_TOKEN }}
61+
commit-message: 'Bump @arduino/docs.arduino.cc to v${{ steps.get_version.outputs.version }}'
62+
title: 'Bump docs.arduino.cc to version ${{ steps.get_version.outputs.version }}'
63+
body: 'Automated PR to update the `@arduino/docs.arduino.cc` dependency to version ${{ steps.get_version.outputs.version }}.'
64+
branch: 'bump-docs-arduino-cc-to-v${{ steps.get_version.outputs.version }}'
65+
base: 'main'

0 commit comments

Comments
 (0)