初始化测试

This commit is contained in:
ilovintit 2026-03-04 13:25:48 +08:00
commit a8a5ca2e75
12 changed files with 13636 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto eol=lf

27
.gitignore vendored Normal file
View File

@ -0,0 +1,27 @@
# Logs
logs
*.log
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# dotenv environment variables file
.env
.env.test
# OS metadata
.DS_Store
Thumbs.db
# IDE files
.idea
.vscode
*.code-workspace
node_modules

16
.prettierrc.json Normal file
View File

@ -0,0 +1,16 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"bracketSameLine": true,
"arrowParens": "avoid",
"proseWrap": "always",
"htmlWhitespaceSensitivity": "css",
"endOfLine": "lf"
}

3
CODEOWNERS Normal file
View File

@ -0,0 +1,3 @@
# Repository CODEOWNERS
* @actions/actions-oss-maintainers

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM node:24-alpine
RUN mkdir /app
WORKDIR /app
COPY . /app
RUN npm install
ENTRYPOINT ["node /app/script/index.js"]

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

111
README.md Normal file
View File

@ -0,0 +1,111 @@
# Hello, World! Docker Action
[![GitHub Super-Linter](https://github.com/actions/hello-world-docker-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
![CI](https://github.com/actions/hello-world-docker-action/actions/workflows/ci.yml/badge.svg)
This action prints `Hello, World!` or `Hello, <who-to-greet>!` to the log. To
learn how this action was built, see
[Creating a Docker container action](https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action).
## Create Your Own Action
To create your own action, you can use this repository as a template! Just
follow the below instructions:
1. Click the **Use this template** button at the top of the repository
1. Select **Create a new repository**
1. Select an owner and name for your new repository
1. Click **Create repository**
1. Clone your new repository
> [!CAUTION]
>
> Make sure to remove or update the [`CODEOWNERS`](./CODEOWNERS) file! For
> details on how to use this file, see
> [About code owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners).
## Usage
Here's an example of how to use this action in a workflow file:
```yaml
name: Example Workflow
on:
workflow_dispatch:
inputs:
who-to-greet:
description: Who to greet in the log
required: true
default: 'World'
type: string
jobs:
say-hello:
name: Say Hello
runs-on: ubuntu-latest
steps:
# Change @main to a specific commit SHA or version tag, e.g.:
# actions/hello-world-docker-action@e76147da8e5c81eaf017dede5645551d4b94427b
# actions/hello-world-docker-action@v1.2.3
- name: Print to Log
id: print-to-log
uses: actions/hello-world-docker-action@main
with:
who-to-greet: ${{ inputs.who-to-greet }}
```
For example workflow runs, check out the
[Actions tab](https://github.com/actions/hello-world-docker-action/actions)!
:rocket:
## Inputs
| Input | Default | Description |
| -------------- | ------- | ------------------------------- |
| `who-to-greet` | `World` | The name of the person to greet |
## Outputs
| Output | Description |
| ------ | ----------------------- |
| `time` | The time we greeted you |
## Test Locally
After you've cloned the repository to your local machine or codespace, you'll
need to perform some initial setup steps before you can test your action.
> [!NOTE]
>
> You'll need to have a reasonably modern version of
> [Docker](https://www.docker.com/get-started/) handy (e.g. docker engine
> version 20 or later).
1. :hammer_and_wrench: Build the container
Make sure to replace `actions/hello-world-docker-action` with an appropriate
label for your container.
```bash
docker build -t actions/hello-world-docker-action .
```
1. :white_check_mark: Test the container
You can pass individual environment variables using the `--env` or `-e` flag.
```bash
$ docker run --env INPUT_WHO_TO_GREET="Mona Lisa Octocat" actions/hello-world-docker-action
::notice file=entrypoint.sh,line=7::Hello, Mona Lisa Octocat!
```
Or you can pass a file with environment variables using `--env-file`.
```bash
$ echo "INPUT_WHO_TO_GREET=\"Mona Lisa Octocat\"" > ./.env.test
$ docker run --env-file ./.env.test actions/hello-world-docker-action
::notice file=entrypoint.sh,line=7::Hello, Mona Lisa Octocat!
```

36
action.yml Normal file
View File

@ -0,0 +1,36 @@
name: Hello, World!
description: Greet someone and record the time
author: GitHub Actions
# Define your inputs here.
inputs:
project-config-path:
description: Project Config Path
required: false
default: 'deploy/we-chat/project.config.json'
upload-setting-path:
description: Upload Setting Path
required: false
default: 'deploy/we-chat/upload.setting.json'
upload-version:
description: Upload Version
required: false
default: '1.0.0'
upload-description:
description: Upload Description
required: false
default: ''
upload-robot:
description: Upload Robot
required: false
default: '1'
runs:
using: docker
image: Dockerfile
env:
INPUT_PROJECT_CONFIG_PATH: ${{ inputs.project-config-path }}
INPUT_UPLOAD_SETTING_PATH: ${{ inputs.upload-setting-path }}
INPUT_UPLOAD_VERSION: ${{ inputs.upload-version }}
INPUT_UPLOAD_DESCRIPTION: ${{ inputs.upload-description }}
INPUT_UPLOAD_ROBOT: ${{ inputs.upload-robot }}

12
entrypoint.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh -l
# Use INPUT_<INPUT_NAME> to get the value of an input
GREETING="Hello, $INPUT_WHO_TO_GREET!"
# Use workflow commands to do things like set debug messages
echo "::notice file=entrypoint.sh,line=7::$GREETING"
# Write outputs to the $GITHUB_OUTPUT file
echo "time=$(date)" >>"$GITHUB_OUTPUT"
exit 0

13321
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

12
package.json Normal file
View File

@ -0,0 +1,12 @@
{
"name": "we-chat-ci",
"version": "1.0.0",
"description": "",
"license": "MIT",
"author": "ilovintit",
"type": "commonjs",
"main": "script/index.js",
"dependencies": {
"miniprogram-ci": "^2.1.26"
}
}

69
script/index.js Normal file
View File

@ -0,0 +1,69 @@
const fs = require('fs')
const path = require('path')
const ci = require('miniprogram-ci')
//
const projectConfigPath = process.env.INPUT_PROJECT_CONFIG_PATH
console.log('projectConfigPath:', projectConfigPath)
//
const uploadSettingPath = process.env.INPUT_UPLOAD_SETTING_PATH
console.log('uploadSettingPath:', uploadSettingPath)
//
const uploadVersion = process.env.INPUT_UPLOAD_VERSION
console.log('uploadVersion:', uploadVersion)
//
const uploadDescription = process.env.INPUT_UPLOAD_DESCRIPTION
console.log('uploadDescription:', uploadDescription)
//
const uploadRobot = Number(process.env.INPUT_UPLOAD_ROBOT)
console.log('uploadRobot:', uploadRobot)
//
const workspace = String(process.env.GITHUB_WORKSPACE)
console.log('workspace:', workspace)
//
const projectConfigJson = fs.readFileSync(
path.join(workspace, projectConfigPath),
'utf8'
)
console.log('projectConfigJson:', projectConfigJson)
const projectConfig = JSON.parse(projectConfigJson)
console.log('deployConfig:', projectConfig)
//
const uploadSettingJson = fs.readFileSync(
path.join(workspace, uploadSettingPath),
'utf8'
)
console.log('uploadSettingJson:', uploadSettingJson)
const uploadSetting = JSON.parse(uploadSettingJson)
console.log('uploadSetting:', uploadSetting)
//
if (!projectConfig.projectPath) {
console.log('projectPath is required')
return
}
projectConfig.projectPath = path.join(workspace, projectConfig.projectPath)
console.log('projectConfig.projectPath:', projectConfig.projectPath)
//
if (!projectConfig.privateKeyPath) {
console.log('privateKeyPath is required')
return
}
projectConfig.privateKeyPath = path.join(
workspace,
projectConfig.privateKeyPath
)
const project = new ci.Project(projectConfig)
ci.upload({
project,
version: uploadVersion,
desc: uploadDescription,
setting: uploadSetting,
robot: uploadRobot,
onProgressUpdate: console.log
})
.then((res) => {
console.log('upload res:', res)
})
.catch((err) => {
console.log('upload err:', err)
})