Skip to content

Commit 5917da7

Browse files
authored
Add files via upload
1 parent 5c71bbd commit 5917da7

File tree

3 files changed

+426
-0
lines changed

3 files changed

+426
-0
lines changed

.github/WORKFLOWS.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# GitHub Actions Workflows
2+
3+
This repository includes automated GitHub Actions that check for new versions of fullPage.js and automatically updates the wrapper when a newer version is available.
4+
5+
## How it works
6+
7+
The workflows run daily at 2 AM UTC and:
8+
9+
1. **Checks for updates**: Compares the current fullPage.js version in `package.json` with the latest version available on npm
10+
2. **Updates dependencies**: If a newer version is found, it updates the fullPage.js dependency
11+
3. **Builds the project**: Runs the build process to ensure everything works correctly
12+
4. **Creates Pull Request**: Automatically creates a PR for review and approval
13+
5. **Updates package version**: Increments the patch version of the vue-fullpage.js package
14+
15+
## Available Workflows
16+
17+
### 1. Automatic Update Workflow
18+
- **Name**: `fullPage.js Update Check`
19+
- **File**: `.github/workflows/fullpage-update-check.yml`
20+
- **Trigger**: Daily at 2 AM UTC + manual trigger
21+
- **Action**: Automatically creates Pull Requests when new versions are found
22+
- **Options**: Force update (even if versions match)
23+
- **Output**: Pull Request with changes ready for review
24+
25+
### 2. Manual Check Workflow
26+
- **Name**: `Manual fullPage.js Version Check`
27+
- **File**: `.github/workflows/manual-fullpage-check.yml`
28+
- **Trigger**: Manual only
29+
- **Action**: Checks for updates without applying them
30+
- **Features**:
31+
- Dry run mode (tests build with latest version)
32+
- Creates GitHub issues for manual review
33+
- Reverts changes after testing
34+
- Safe preview of updates
35+
36+
## Manual trigger
37+
38+
You can manually trigger either workflow:
39+
40+
1. Go to the **Actions** tab in this repository
41+
2. Select the desired workflow:
42+
- **fullPage.js Update Check** - for automatic PR creation
43+
- **Manual fullPage.js Version Check** - for safe checking
44+
3. Click **Run workflow**
45+
4. Configure options as needed
46+
47+
## What gets updated
48+
49+
- `package.json`: fullPage.js dependency version and package version
50+
- `package-lock.json`: Updated lock file
51+
- `dist/`: Rebuilt distribution files
52+
- **Pull Request**: Created with all changes for review
53+
54+
## Release Process
55+
56+
After the Pull Request is created:
57+
1. **Review**: Check the changes and test if needed
58+
2. **Merge**: Approve and merge the PR when ready
59+
3. **Release**: Manually create a GitHub release after merging (optional)
60+
61+
## Branch Strategy
62+
63+
The automatic workflow creates new feature branches for each update:
64+
- **Branch naming**: `update/fullpage-{version}` (e.g., `update/fullpage-4.0.33`)
65+
- **Source**: Current main/master branch
66+
- **Cleanup**: Branches are automatically deleted after PR merge
67+
68+
## Workflow Output Examples
69+
70+
### Successful Update
71+
```
72+
## ✅ Update Completed Successfully
73+
Updated fullPage.js from ^4.0.32 to 4.0.33
74+
New package version: 0.2.22
75+
Pull Request created for review
76+
```
77+
78+
### No Update Needed
79+
```
80+
## ℹ️ No Update Needed
81+
Current fullPage.js version (^4.0.32) is up to date
82+
Latest available version: 4.0.32
83+
```
84+
85+
## Pull Request Content
86+
87+
The automatic workflow creates PRs with:
88+
- **Title**: `chore: update fullPage.js to {version}`
89+
- **Labels**: `dependencies`, `fullpage-update`, `automated`
90+
- **Description**: Detailed changelog and instructions
91+
- **Files**: Updated package.json, package-lock.json, and built dist files
92+
93+
## Benefits
94+
95+
The workflows ensure that vue-fullpage.js stays up-to-date with the latest fullPage.js features and bug fixes while maintaining quality control through the PR review process.
96+
97+
- **Automation**: Daily checks and automatic PR creation
98+
- **Safety**: No direct pushes to main branch
99+
- **Quality Control**: Review process for all changes
100+
- **Transparency**: Clear documentation and labels
101+
- **Flexibility**: Manual override options available
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: fullPage.js Update Check
2+
3+
on:
4+
schedule:
5+
# Run daily at 2 AM UTC
6+
- cron: '0 2 * * *'
7+
workflow_dispatch:
8+
inputs:
9+
force_update:
10+
description: 'Force update even if versions are the same'
11+
required: false
12+
default: 'false'
13+
type: boolean
14+
15+
jobs:
16+
check-and-update:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
fetch-depth: 0
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '18'
30+
cache: 'npm'
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Get current fullPage.js version
36+
id: current-version
37+
run: |
38+
CURRENT_VERSION=$(node -p "require('./package.json').dependencies['fullpage.js']")
39+
# Remove the ^ prefix for comparison
40+
CURRENT_CLEAN=$(echo $CURRENT_VERSION | sed 's/^[^0-9]*//')
41+
echo "current_version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
42+
echo "current_clean=${CURRENT_CLEAN}" >> $GITHUB_OUTPUT
43+
echo "Current fullPage.js version: $CURRENT_VERSION (clean: $CURRENT_CLEAN)"
44+
45+
- name: Get latest fullPage.js version from npm
46+
id: latest-version
47+
run: |
48+
LATEST_VERSION=$(npm view fullpage.js version)
49+
echo "latest_version=${LATEST_VERSION}" >> $GITHUB_OUTPUT
50+
echo "Latest fullPage.js version: $LATEST_VERSION"
51+
52+
- name: Compare versions using semver
53+
id: compare-versions
54+
run: |
55+
CURRENT_CLEAN="${{ steps.current-version.outputs.current_clean }}"
56+
LATEST_VERSION="${{ steps.latest-version.outputs.latest_version }}"
57+
58+
# Use npm's semver comparison
59+
if npm semver $LATEST_VERSION --gt $CURRENT_CLEAN; then
60+
echo "update_needed=true" >> $GITHUB_OUTPUT
61+
echo "Update needed: $CURRENT_CLEAN -> $LATEST_VERSION"
62+
else
63+
echo "update_needed=false" >> $GITHUB_OUTPUT
64+
echo "No update needed: $CURRENT_CLEAN >= $LATEST_VERSION"
65+
fi
66+
67+
- name: Check if force update is requested
68+
id: force-check
69+
run: |
70+
if [ "${{ github.event.inputs.force_update }}" = "true" ]; then
71+
echo "force_update=true" >> $GITHUB_OUTPUT
72+
echo "Force update requested"
73+
else
74+
echo "force_update=false" >> $GITHUB_OUTPUT
75+
fi
76+
77+
- name: Determine if update should proceed
78+
id: should-update
79+
run: |
80+
if [ "${{ steps.compare-versions.outputs.update_needed }}" = "true" ] || [ "${{ steps.force-check.outputs.force_update }}" = "true" ]; then
81+
echo "should_update=true" >> $GITHUB_OUTPUT
82+
echo "Update will proceed"
83+
else
84+
echo "should_update=false" >> $GITHUB_OUTPUT
85+
echo "No update needed"
86+
fi
87+
88+
- name: Update fullPage.js dependency
89+
if: steps.should-update.outputs.should_update == 'true'
90+
run: |
91+
LATEST_VERSION="${{ steps.latest-version.outputs.latest_version }}"
92+
echo "Updating fullPage.js to version $LATEST_VERSION..."
93+
npm install fullpage.js@$LATEST_VERSION --save
94+
echo "Updated fullPage.js to version $LATEST_VERSION"
95+
96+
- name: Update package version
97+
if: steps.should-update.outputs.should_update == 'true'
98+
id: package-version
99+
run: |
100+
# Get current package version
101+
CURRENT_PKG_VERSION=$(node -p "require('./package.json').version")
102+
echo "Current package version: $CURRENT_PKG_VERSION"
103+
104+
# Increment patch version
105+
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_PKG_VERSION"
106+
NEW_PATCH=$((VERSION_PARTS[2] + 1))
107+
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$NEW_PATCH"
108+
109+
# Update package.json version
110+
npm version $NEW_VERSION --no-git-tag-version
111+
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
112+
echo "Updated package version to: $NEW_VERSION"
113+
114+
- name: Build project
115+
if: steps.should-update.outputs.should_update == 'true'
116+
run: |
117+
echo "Building project..."
118+
npm run build
119+
echo "Build completed successfully"
120+
121+
- name: Create Pull Request
122+
if: steps.should-update.outputs.should_update == 'true'
123+
uses: peter-evans/create-pull-request@v5
124+
with:
125+
token: ${{ secrets.GITHUB_TOKEN }}
126+
branch: update/fullpage-${{ steps.latest-version.outputs.latest_version }}
127+
title: "chore: update fullPage.js to ${{ steps.latest-version.outputs.latest_version }}"
128+
body: |
129+
## fullPage.js Update
130+
131+
**Current version:** ${{ steps.current-version.outputs.current_version }}
132+
**New version:** ${{ steps.latest-version.outputs.latest_version }}
133+
**Package version:** ${{ steps.package-version.outputs.new_version }}
134+
135+
### Changes made:
136+
- Updated fullPage.js dependency to ${{ steps.latest-version.outputs.latest_version }}
137+
- Incremented package version to ${{ steps.package-version.outputs.new_version }}
138+
- Built project successfully
139+
140+
### What to do:
141+
1. Review the changes
142+
2. Test the build locally if needed
143+
3. Merge when ready
144+
145+
---
146+
*This PR was created automatically by the GitHub Action.*
147+
commit-message: "chore: update fullPage.js to ${{ steps.latest-version.outputs.latest_version }}"
148+
delete-branch: true
149+
labels: |
150+
dependencies
151+
fullpage-update
152+
automated
153+
154+
- name: Send notification on success
155+
if: steps.should-update.outputs.should_update == 'true'
156+
run: |
157+
echo "## ✅ Update Completed Successfully"
158+
echo "Updated fullPage.js from ${{ steps.current-version.outputs.current_version }} to ${{ steps.latest-version.outputs.latest_version }}"
159+
echo "New package version: ${{ steps.package-version.outputs.new_version }}"
160+
echo "Pull Request created for review"
161+
162+
- name: Send notification on no update
163+
if: steps.should-update.outputs.should_update == 'false'
164+
run: |
165+
echo "## ℹ️ No Update Needed"
166+
echo "Current fullPage.js version (${{ steps.current-version.outputs.current_version }}) is up to date"
167+
echo "Latest available version: ${{ steps.latest-version.outputs.latest_version }}"

0 commit comments

Comments
 (0)