Skip to content

自动发布

自动发布 #4

name: 自动发布
on:
pull_request:
types:
- closed
branches:
- master
workflow_dispatch:
jobs:
publish-and-pr:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run publish script
run: npm run publish
# Configure Git for committing changes
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Commit and push changes to a new branch
- name: Commit and create branch
run: |
git checkout -b auto-publish-changes-$(date +%s)
git add .
git commit -m "Automated changes after publish"
# Push changes and create a PR
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: auto-publish-changes-$(date +%s)
branch-overwrite: true
title: "Automated Changes After Publish"
body: |
This PR was created automatically after running the publish script on the master branch.
commit-message: "Automated changes after publish"