Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
steve02081504 committed Feb 17, 2025
1 parent edca839 commit 3b3890f
Show file tree
Hide file tree
Showing 11 changed files with 566 additions and 21 deletions.
62 changes: 62 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "bug report🕷"
description: help us improve
title: a bug
labels: bug
assignees: steve02081504
body:
- type: checkboxes
attributes:
label: 检查清单 Prerequisites
options:
- label: "请确保你是在最新版本中遇见此问题\nMake sure you have this bug in the latest release"
id: latest-release
required: true
- label: "请确保你已经检索了已关闭的问题,以确保你的问题没有被重复提交\nMake sure you have retrieved closed issues to make sure your issue has not been submitted repeatedly"
id: closed-issues
required: true

- type: textarea
id: bug-description
attributes:
label: "描述错误\nDescribe the bug"
description: |
对错误的清晰简明的描述于此
A clear and concise description of what the bug is.
validations:
required: true

- type: textarea
id: fount-pwsh-usage
attributes:
label: "复现\nTo Reproduce"
description: |
你如何使用fount-pwsh
How do you use fount-pwsh.
validations:
required: true

- type: textarea
id: expected-behavior
attributes:
label: "预期行为\nExpected behavior"
description: |
对你期望发生的事的清晰而简明的描述
A clear and concise description of what you expected to happen.
validations:
required: true

- type: textarea
id: screenshorts
attributes:
label: "截图\nScreenshots"
description: |
如果可以,请添加截图以帮助解释你的问题
If applicable, add screenshots to help explain your problem.
- type: textarea
id: additional-context
attributes:
label: "附加上下文\nAdditional context"
description: |
在此处添加有关该问题的任何其他上下文
Add any other context about the problem here.
68 changes: 68 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: "feature request🎨"
description: Suggest idea
title: a feature request
labels: enhancement
assignees:
- steve02081504
body:
- type: checkboxes
attributes:
label: 检查清单 Prerequisites
options:
- label: "请确保你已经检索了已关闭的问题,以确保你的问题没有被重复提交\nMake sure you have retrieved closed issues to make sure your issue has not been submitted repeatedly"
id: closed-issues
required: true

- type: textarea
id: problem
attributes:
label: "问题描述\nProblem description"
description: |
你的建议是否与什么问题有关?请描述一下。
Is your feature request related to a problem? Please describe.
placeholder: |
对你遇见的问题的清晰简明的描述于此
A clear and concise description of what the problem is.
例:我总是感到沮丧当 [...]
Ex. I'm always frustrated when [...]
validations:
required: true

- type: textarea
id: solution
attributes:
label: "解决方案描述\nSolution description"
description: |
描述你想要的解决方案
Describe the solution you'd like
placeholder: |
对你想要的解决方案的清晰简明的描述于此
A clear and concise description of what you want to happen.
例:我希望能够 [...]
Ex. I'd like to see [...]
validations:
required: true

- type: textarea
id: alternatives
attributes:
label: "替代方案描述\nAlternative description"
description: |
描述你考虑过的替代方案
Describe alternatives you've considered
placeholder: |
对你考虑过的任何替代方案或功能的清晰简明的描述
A clear and concise description of any alternative solutions or features you've considered.
例:一种替代性的方案,可以 [...]
Ex. One alternative solution could be [...]
- type: textarea
id: context
attributes:
label: "附加内容\nAdditional context"
description: |
附加内容
Additional context
placeholder: |
在此处添加有关功能请求的任何其他上下文或屏幕截图
Add any other context or screenshots about the feature request here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: "other🔮"
about: nothing
title: a issue
labels: ''
assignees: steve02081504

---


12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: "default"
about: default pull request template
title: change name
assignees: steve02081504

---
**感谢你对fount-pwsh做出的贡献**
**Thank you for your contribution to fount-pwsh**

如果你自信其他人能通过观察你对项目的修改得知你的意图,这里可以什么都不填。如果不能,请描述你的修改直至你认为其他人可以看懂修改的缘由
If you are confident that others will know your intentions by observing your modifications to the project, you can fill in nothing here. If not, please describe your change until you think others can understand the reason for the modification.
43 changes: 43 additions & 0 deletions .github/workflows/PSObjectToString.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
$script:tabnum = 0
function PSObjectToString($obj, [Switch]$OneLine = $false) {
if ($obj -is [System.Collections.IDictionary]) {
$script:tabnum += 1
$str = ''
if ($obj -is [System.Collections.Specialized.OrderedDictionary]) {
$str = '[ordered]'
}
$str += '@{'
if (-not $OneLine) {
$str += "`n"
}
$str += (($obj.GetEnumerator() | ForEach-Object {
if (-not $OneLine) {
"`t" * $script:tabnum
}
$_.Key + ' = ' + $(PSObjectToString $_.Value $OneLine)
if (-not $OneLine) { "`n" }
else { ';' }
}) -join '')
if (-not $OneLine) {
$str += "`t" * ($script:tabnum - 1)
}
$str += '}'
$str
$script:tabnum -= 1
}
elseif ($obj -is [System.Collections.ICollection]) {
'@(' + (($obj | ForEach-Object {
PSObjectToString $_ $OneLine
', '
} | Select-Object -SkipLast 1) -join '') + ')'
}
elseif ($obj -is [string]) {
"'" + $obj.Replace("'", "''") + "'"
}
elseif ($obj -is [int]) { $obj }
elseif ($obj -is [bool] -or $obj -is [switch]) { "`$$obj" }
else { "$obj" }
}
function Get-ArgsString([hashtable]$Params) {
$Params.GetEnumerator() | ForEach-Object { "-$($_.Key):$(PSObjectToString $_.Value -OneLine)" }
}
57 changes: 57 additions & 0 deletions .github/workflows/Publish.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# pwsh ./.github/workflows/publish.ps1 -version ${{ github.ref_name }} -ApiKey ${{ secrets.NUGET_API_KEY }}

[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$version,
[Parameter(Mandatory = $true)]
[string]$ApiKey
)
if ($version -match '^v(\d+\.\d+\.\d+)$') {
$version = $Matches[1]
}
else {
throw "invalid version: $version"
}

$repoPath = "$PSScriptRoot/../.."
. $PSScriptRoot/PSObjectToString.ps1
$error.clear()

try {
# read psd1
$packData = Import-PowerShellDataFile "$repoPath/fount-pwsh.psd1"
# update version
$packData.ModuleVersion = $version
# update psd1
Set-Content -Path "$repoPath/fount-pwsh.psd1" -Value $(PSObjectToString($packData)) -NoNewline -Encoding UTF8 -Force
# 遍历文件列表,移除.开头的文件和文件夹
Get-ChildItem -Path $repoPath -Recurse | Where-Object { $_.Name -match '^\.' } | ForEach-Object { Remove-Item -Path $_.FullName -Force -Recurse }
# 打包发布
Install-Module -Name 'PowerShellGet' -Force -Scope CurrentUser | Out-Null
$errnum = $Error.Count
Publish-Module -Path $repoPath -NuGetApiKey $ApiKey -ErrorAction Stop
while ($Error.Count -gt $errnum) {
$Error.RemoveAt(0)
}
}
catch {}

if ($error) {
Write-Output "::group::PSVersion"
Write-Output $PSVersionTable
Write-Output "::endgroup::"

$error | ForEach-Object {
Write-Output "::error file=$($_.InvocationInfo.ScriptName),line=$($_.InvocationInfo.ScriptLineNumber),col=$($_.InvocationInfo.OffsetInLine),endColumn=$($_.InvocationInfo.OffsetInLine),tittle=error::$_"
Write-Output "::group::script stack trace"
Write-Output $_.ScriptStackTrace
Write-Output "::endgroup::"
Write-Output "::group::error details"
Write-Output $_
Write-Output "::endgroup::"
}
exit 1
}

Write-Output "Nice CI!"
21 changes: 21 additions & 0 deletions .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish Release to PowerShell Gallery

on:
push:
tags:
- v*
workflow_dispatch:
inputs:
version:
description: 'Version to publish'
required: true
default: 'v0.0.0'

jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Run a one-line script
shell: pwsh
run: ./.github/workflows/publish.ps1 -version ${{ github.event.inputs.version || github.ref_name }} -ApiKey ${{ secrets.NUGET_API_KEY }}
Loading

0 comments on commit 3b3890f

Please sign in to comment.