This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
UpTool2/.github/workflows/main.yml

108 lines
4.5 KiB
YAML
Raw Normal View History

name: CD
2019-11-13 14:34:29 +01:00
2019-12-19 21:03:03 +01:00
on: [push]
2019-11-13 14:34:29 +01:00
jobs:
build:
runs-on: windows-latest
steps:
2020-03-08 13:23:03 +01:00
- uses: actions/checkout@v2.0.0
2020-03-08 13:00:03 +01:00
- name: Setup NuGet
2020-03-08 13:23:03 +01:00
uses: nuget/setup-nuget@v1.0.2
2020-03-08 13:00:03 +01:00
with:
nuget-version: latest
2019-12-19 21:43:27 +01:00
- name: Build
2019-12-19 21:28:25 +01:00
id: base_init
2019-11-13 14:34:29 +01:00
run: |
2020-03-08 12:54:58 +01:00
cd $Env:GITHUB_WORKSPACE
nuget restore
2019-11-13 14:34:29 +01:00
cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\"
2020-03-08 10:48:27 +01:00
.\MSBuild.exe -noLogo -verbosity:m $Env:GITHUB_WORKSPACE\UpTool2.sln -p:Configuration=Release
2020-03-08 13:12:41 +01:00
cp "$Env:GITHUB_WORKSPACE\UpTool build tool\bin\Release\netcoreapp3.1\package.zip" $Env:GITHUB_WORKSPACE\Tools.zip
2019-11-13 15:02:36 +01:00
cd "C:\Program Files\7-Zip\"
2020-03-13 20:20:25 +01:00
.\7z a $Env:GITHUB_WORKSPACE\Release.zip $Env:GITHUB_WORKSPACE\UpTool2\bin\Release\netcoreapp3.1
cd $Env:GITHUB_WORKSPACE\UpTool2\bin\Release\netcoreapp3.1
2020-03-13 20:32:20 +01:00
ls
echo "UpTool version"
2020-03-13 20:20:25 +01:00
$asmver = $([Reflection.Assembly]::Loadfile($(pwd).Path + "\\UpTool2.dll").GetName().version.ToString())
2020-03-13 20:27:29 +01:00
echo "pkgtool version"
2020-03-08 13:15:21 +01:00
cd "$Env:GITHUB_WORKSPACE\UpTool build tool\bin\Release\netcoreapp3.1"
$pkgtoolver = $([Reflection.Assembly]::Loadfile($(pwd).Path + "\\pkgtool.dll").GetName().version.ToString())
2019-11-13 14:34:29 +01:00
cd $Env:GITHUB_WORKSPACE
2019-12-19 21:28:25 +01:00
echo "::set-output name=vers::$asmver"
2020-03-08 11:21:19 +01:00
echo "::set-output name=pkgvers::$pkgtoolver"
2019-12-19 20:46:42 +01:00
- name: Create Release
id: create_release
2020-03-08 13:23:03 +01:00
uses: actions/create-release@v1.0.1
2019-12-19 20:46:42 +01:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2019-11-13 14:34:29 +01:00
with:
2019-12-19 21:28:25 +01:00
tag_name: ${{ steps.base_init.outputs.vers }}
release_name: Release ${{ steps.base_init.outputs.vers }}
2019-12-19 20:46:42 +01:00
draft: false
prerelease: false
- name: Upload Release Asset
id: upload_release_asset
2020-03-08 13:23:03 +01:00
uses: actions/upload-release-asset@v1.0.2
2019-12-19 20:46:42 +01:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2019-12-19 21:43:27 +01:00
upload_url: ${{ steps.create_release.outputs.upload_url }}
2019-12-19 20:53:50 +01:00
asset_path: ./Release.zip
2019-12-19 20:46:42 +01:00
asset_name: Release.zip
asset_content_type: application/zip
2020-03-08 10:42:24 +01:00
- name: Upload Tool Asset
id: upload_tool_asset
2020-03-08 13:23:03 +01:00
uses: actions/upload-release-asset@v1.0.2
2020-03-08 10:42:24 +01:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Tools.zip
asset_name: Tools.zip
asset_content_type: application/zip
2020-03-11 21:06:36 +01:00
- name: Create XML
2020-03-11 20:51:42 +01:00
id: package_tool_xml
2019-12-19 21:43:27 +01:00
run: |
2020-03-11 20:51:42 +01:00
[System.XML.XMLDocument]$xml=New-Object System.XML.XMLDocument
[System.XML.XMLElement]$app=$xml.CreateElement("app")
$xml.appendChild($app)
$app.appendChild($xml.CreateElement("Name")).InnerText = "UpTool2 package tools"
$app.appendChild($xml.CreateElement("Description")).InnerText = "Tools for automating package creation"
$app.appendChild($xml.CreateElement("Version")).InnerText = "${{ steps.base_init.outputs.pkgvers }}"
$app.appendChild($xml.CreateElement("ID")).InnerText = "0e35d154-d0d3-45e0-b080-62f521263a44"
$app.appendChild($xml.CreateElement("File")).InnerText = "${{ steps.upload_tool_asset.outputs.browser_download_url }}"
$app.appendChild($xml.CreateElement("Hash")).InnerText = $(Get-FileHash $Env:GITHUB_WORKSPACE\Tools.zip).Hash
2020-03-11 21:02:04 +01:00
echo NULL > tools.xml
$xml.save($(gi .\tools.xml).Fullname)
2020-03-11 20:51:42 +01:00
[System.XML.XMLDocument]$xml=New-Object System.XML.XMLDocument
[System.XML.XMLElement]$app=$xml.CreateElement("meta")
$xml.appendChild($app)
$app.appendChild($xml.CreateElement("Version")).InnerText = "${{ steps.base_init.outputs.vers }}"
$app.appendChild($xml.CreateElement("File")).InnerText = "${{ steps.upload_release_asset.outputs.browser_download_url }}"
$app.appendChild($xml.CreateElement("Hash")).InnerText = $(Get-FileHash $Env:GITHUB_WORKSPACE\Release.zip).Hash
echo NULL > meta.xml
$xml.save($(gi .\meta.xml).Fullname)
2020-03-11 21:06:36 +01:00
- name: Upload Meta XML
id: upload_meta_xml
2020-03-11 20:51:42 +01:00
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2020-03-11 21:06:36 +01:00
asset_path: ./meta.xml
asset_name: meta.xml
2020-03-11 20:51:42 +01:00
asset_content_type: text/xml
2020-03-11 21:06:36 +01:00
- name: Upload Tool XML
id: upload_tool_xml
2020-03-11 20:51:42 +01:00
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2020-03-11 21:06:36 +01:00
asset_path: ./tools.xml
asset_name: tools.xml
2020-03-11 20:51:42 +01:00
asset_content_type: text/xml