Added many, many more actions.
This commit is contained in:
67
tpl/tpl-to-nuspec/action.yaml
Normal file
67
tpl/tpl-to-nuspec/action.yaml
Normal file
@@ -0,0 +1,67 @@
|
||||
name: tpl-to-nuspec
|
||||
description: "Pack a .nupkg given a .nuspec Go template file and a yaml input file. The input yaml file environment variables replaced first."
|
||||
inputs:
|
||||
template:
|
||||
description: "Template or local path of the template file to use. Defaults to the template file in the action's directory."
|
||||
required: false
|
||||
input:
|
||||
description: "Input or local path of the yaml input data file."
|
||||
required: true
|
||||
outputs:
|
||||
nuspec:
|
||||
description: "The generated output .nuspec file."
|
||||
value: ${{ steps.xml.outputs.result }}
|
||||
packageName:
|
||||
description: "The 'name' property of the generated .nuspec file."
|
||||
value: ${{ steps.name.outputs.result }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Set template variable."
|
||||
id: get-template
|
||||
run: |
|
||||
TEMPLATE=$(cat << EOF
|
||||
${{ inputs.template }}
|
||||
EOF
|
||||
)
|
||||
if [[ -z "$TEMPLATE" ]]; then
|
||||
TEMPLATE="${{ github.action_path }}/nuspec.yaml.tpl"
|
||||
fi
|
||||
|
||||
echo "template<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "$TEMPLATE" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
shell: bash
|
||||
- name: "Merge Input"
|
||||
id: merge
|
||||
uses: act/common/yq/yq-merge@master
|
||||
with:
|
||||
lhs: ${{ github.action_path }}/defaults.yaml
|
||||
rhs: ${{ inputs.input }}
|
||||
- name: "Generate Nuspec Yaml from Template"
|
||||
id: template
|
||||
uses: act/common/tpl/tpl-env@master
|
||||
with:
|
||||
template: ${{ steps.get-template.outputs.template }}
|
||||
decoder: yaml
|
||||
input: ${{ steps.merge.outputs.result }}
|
||||
- name: "Convert the Nuspec Yaml to XML"
|
||||
id: trim
|
||||
uses: act/common/yq/yq-trim@master
|
||||
with:
|
||||
input: ${{ steps.template.outputs.result }}
|
||||
recursive: true
|
||||
- name: "Convert the Nuspec Yaml to XML"
|
||||
id: xml
|
||||
uses: act/common/yq/yq-convert@master
|
||||
with:
|
||||
input: ${{ steps.trim.outputs.result }}
|
||||
from: yaml
|
||||
to: xml
|
||||
- name: "Get id from input."
|
||||
id: name
|
||||
uses: act/common/yq/yq-expression@master
|
||||
with:
|
||||
input: ${{ steps.merge.outputs.result }}
|
||||
expression: .id
|
||||
|
||||
16
tpl/tpl-to-nuspec/defaults.yaml
Normal file
16
tpl/tpl-to-nuspec/defaults.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
authors:
|
||||
- lewdorg Inc
|
||||
name: ${GITHUB_REPOSITORY}
|
||||
version: 0.0.0-dev
|
||||
projectUrl: https://lewdorg.com
|
||||
iconUrl: https://lewdorg.com/wp-content/uploads/2022/03/cropped-lewdorg-Profile-Circle-Light-1-1-270x270.png
|
||||
copyright: '© Copyright {{ now | date "2006" }} lewdorg Inc, Patents Issued.'
|
||||
repository:
|
||||
type: git
|
||||
url: git@github.lewdorg.com:${GITHUB_REPOSITORY}.git
|
||||
branch: ${GITHUB_REF_NAME}
|
||||
commit: ${GITHUB_SHA}
|
||||
tags:
|
||||
- lewdorg
|
||||
requireLicenseAcceptance: false
|
||||
language: en-US
|
||||
67
tpl/tpl-to-nuspec/example.yaml
Normal file
67
tpl/tpl-to-nuspec/example.yaml
Normal file
@@ -0,0 +1,67 @@
|
||||
# This file provides an example for the desired Yaml format for a .nuspec file.
|
||||
# Required Metadata
|
||||
id: Example.Package
|
||||
version: 1.0.0
|
||||
description: This is an example package.
|
||||
authors:
|
||||
- John Doe
|
||||
|
||||
# Optional Metadata
|
||||
title: Example Package
|
||||
license:
|
||||
content: MIT
|
||||
type: expression
|
||||
projectUrl: https://example.com
|
||||
iconUrl: icon.png
|
||||
icon:
|
||||
src: icon.png
|
||||
target: icon.png
|
||||
requireLicenseAcceptance: false
|
||||
developmentDependency: true
|
||||
summary: This is a summary of the example package.
|
||||
releaseNotes: This is the first release of the example package.
|
||||
language: en-US
|
||||
tags:
|
||||
- example
|
||||
- tag1
|
||||
- tag2
|
||||
repository:
|
||||
type: git
|
||||
url: https://github.com/example/example.package
|
||||
branch: master
|
||||
commit: 0a1b2c3d
|
||||
|
||||
path: /root
|
||||
# Content
|
||||
content:
|
||||
path: /content
|
||||
files:
|
||||
- include: any/any/config.json
|
||||
buildAction: Content
|
||||
copyToOutput: "true"
|
||||
flatten: "true"
|
||||
|
||||
# Source Files
|
||||
source:
|
||||
path: /source
|
||||
groups:
|
||||
- framework: .NETStandard2.0
|
||||
references:
|
||||
- name: System.Data
|
||||
dependencies:
|
||||
- id: Example.Dependency
|
||||
version: 1.0.0
|
||||
exclude:
|
||||
- Build
|
||||
- Analyzers
|
||||
files:
|
||||
- name: Example.Package.dll
|
||||
- name: Example.Package.pdb
|
||||
dlls:
|
||||
- name: Unity.Package
|
||||
- files:
|
||||
- name: icon.png
|
||||
target: content
|
||||
- framework: net40
|
||||
assemblies:
|
||||
- name: System.IO
|
||||
133
tpl/tpl-to-nuspec/nuspec.yaml.tpl
Normal file
133
tpl/tpl-to-nuspec/nuspec.yaml.tpl
Normal file
@@ -0,0 +1,133 @@
|
||||
+p_xml: version="1.0" encoding="utf-8"
|
||||
package:
|
||||
+@xmlns: http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd
|
||||
metadata:
|
||||
id: {{ .id | default "" }}
|
||||
version: {{ .version | default "" }}
|
||||
description: {{ .description | default "" }}
|
||||
authors: "{{ join ", " .authors | default "" }}"
|
||||
|
||||
title: {{ .title | default "" }}
|
||||
projectUrl: {{ .projectUrl | default "" }}
|
||||
licenseUrl: {{ .licenseUrl | default "" }}
|
||||
{{- with .license }}
|
||||
license:
|
||||
{{- if .content }}
|
||||
+content: {{ .content }}
|
||||
{{- end }}
|
||||
{{- if .type }}
|
||||
+@type: {{ .type }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
icon: {{ .icon | default "" }}
|
||||
iconUrl: {{ .iconUrl | default "" }}
|
||||
requireLicenseAcceptance: {{ .requireLicenseAcceptance | default "" }}
|
||||
developmentDependency: {{ .developmentDependency | default "" }}
|
||||
{{- if .copyright }}
|
||||
copyright: {{ tpl (toYaml .copyright) $ }}
|
||||
{{- end }}
|
||||
summary: {{ .summary | default "" }}
|
||||
releaseNotes: {{ .releaseNotes | default "" }}
|
||||
language: {{ .language | default "" }}
|
||||
tags: "{{ join ", " .tags | default "" }}"
|
||||
{{- with .repository }}
|
||||
repository:
|
||||
{{- if .type }}
|
||||
+@type: {{ .type }}
|
||||
{{- end }}
|
||||
{{- if .url }}
|
||||
+@url: {{ .url }}
|
||||
{{- end }}
|
||||
{{- if .branch }}
|
||||
+@branch: {{ .branch }}
|
||||
{{- end }}
|
||||
{{- if .commit }}
|
||||
+@commit: {{ .commit }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with $.source }}
|
||||
{{- $path := print (default "." $.path) "/" (default "." .path) | clean }}
|
||||
dependencies:
|
||||
group:
|
||||
{{- range $item := .groups }}
|
||||
{{- if and $item.framework }}
|
||||
- +@targetFramework: {{ $item.framework }}
|
||||
dependency:
|
||||
{{- range $dep := $item.dependencies }}
|
||||
- +@id: {{ $dep.id }}
|
||||
+@version: {{ $dep.version }}
|
||||
+@exclude: "{{ join ", " $dep.exclude }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
references:
|
||||
group:
|
||||
{{- range $item := .groups }}
|
||||
{{- if and $item.framework $item.references }}
|
||||
- +@targetFramework: {{ $item.framework }}
|
||||
{{- range $ref := $item.references }}
|
||||
- reference:
|
||||
+@file: {{ print $path "/" $ref.name | clean }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
frameworkAssemblies:
|
||||
frameworkAssembly:
|
||||
{{- range $item := .groups }}
|
||||
{{- range $ref := $item.assemblies }}
|
||||
- +@assemblyName: {{ $ref.name }}
|
||||
{{- if $item.framework }}
|
||||
+@targetFramework: {{ $item.framework }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $.content }}
|
||||
{{- $path := print (default "." $.path) "/" (default "." .path) | clean }}
|
||||
contentFiles:
|
||||
files:
|
||||
{{- range $file := .files }}
|
||||
- +@include: {{ print $path "/" $file.include | clean }}
|
||||
{{- if $file.exclude }}
|
||||
+@exclude: {{ print $path "/" $file.exclude | clean }}
|
||||
{{- end }}
|
||||
{{- if $file.buildAction }}
|
||||
+@buildAction: {{ $file.buildAction }}
|
||||
{{- end }}
|
||||
{{- if $file.copyToOutput }}
|
||||
+@copyToOutput: {{ $file.copyToOutput }}
|
||||
{{- end }}
|
||||
{{- if $file.flatten }}
|
||||
+@flatten: {{ $file.flatten }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $.source }}
|
||||
{{- $path := print (default "." $.path) "/" (default "." .path) | clean }}
|
||||
files:
|
||||
file:
|
||||
{{- range $item := .groups }}
|
||||
{{- range $file := $item.files }}
|
||||
- +@src: {{ print $path "/" $file.name | clean }}
|
||||
{{- if $item.framework }}
|
||||
+@target: {{ print "lib/" $item.framework "/" (default $file.target ".") | clean }}
|
||||
{{- else if $file.target }}
|
||||
+@target: {{ $file.target }}
|
||||
{{- end }}
|
||||
{{- if $file.exclude }}
|
||||
+@exclude: {{ print $path "/" $file.exclude | clean }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $item.framework }}
|
||||
{{- range $dll := $item.dlls }}
|
||||
- +@src: {{ print $path "/" $dll.name ".dll" | clean }}
|
||||
+@target: {{ print "lib/" $item.framework "/" (default $item.target ".") | clean }}
|
||||
{{- if ($dll.hasPdb | default true) }}
|
||||
- +@src: {{ print $path "/" $dll.name ".pdb" | clean }}
|
||||
+@target: {{ print "lib/" $item.framework "/" (default $item.target ".") | clean }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user