[go: nahoru, domu]

Skip to content

Commit

Permalink
choco build updates
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Jan 2, 2022
1 parent 0719792 commit 3bd9c6e
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 83 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
build:
runs-on: windows-latest
steps:
- name: Context
- name: Report Context
run: |
echo event: ${{ github.event }}
echo repository: ${{ github.repository }}
echo ref: ${{ github.ref }}
echo head_ref: ${{ github.head_ref }}
echo base_ref: ${{ github.base_ref }}
echo "event: ${{ github.event }}"
echo "repository: ${{ github.repository }}"
echo "ref: ${{ github.ref }}"
echo "head_ref: ${{ github.head_ref }}"
echo "base_ref: ${{ github.base_ref }}"
# under $GITHUB_WORKSPACE
# fetch history so release notes can be generated from
Expand Down Expand Up @@ -81,6 +81,17 @@ jobs:
with:
path: pyrevitlib/pyrevit/version

- name: Get Install Version
id: installversion
uses: juliangruber/read-file-action@v1
with:
path: release/version

- name: Report Build and Install Versions
run: |
echo "build: v${{ steps.buildversion.outputs.content }}"
echo "install: v${{ steps.installversion.outputs.content }}"
- name: Sign Binaries
uses: skymatic/code-sign-action@v1
with:
Expand Down Expand Up @@ -166,3 +177,12 @@ jobs:
git checkout ${{ github.base_ref }}
git merge ${{ github.head_ref }}
git push
# RELEASE only
- name: Publish Choco Packages
if: (github.base_ref == env.ReleaseBranch)
run: |
choco pack release/choco/pyrevit-cli.nuspec --outdir dist
choco apikey -k ${{ secrets.CHOCO_TOKEN}} -source https://push.chocolatey.org/
choco push dist/pyrevit-cli.${{ steps.installversion.outputs.content }}.nupkg -s https://push.chocolatey.org/
1 change: 1 addition & 0 deletions dev/_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
RequiredTool(
name="iscc", get=r"C:\Program Files (x86)\Inno Setup 6", step="release"
),
RequiredTool(name="choco", get="", step="release"),
]


Expand Down
25 changes: 20 additions & 5 deletions dev/_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ def _modify_contents(files, finder, new_value):
sfile.writelines(contents)


def _modify_choco_nuspec(build_version: str, install_version: str):
build_version_urlsafe = build_version.replace("+", "%2B")
releasenotes_url = (
"https://github.com/eirannejad/pyRevit/"
f"releases/tag/v{build_version_urlsafe}/"
)
nuspec_files = [configs.PYREVIT_CHOCO_NUSPEC_FILE]


def get_version():
"""Get current version"""
for verfile in configs.VERSION_FILES:
Expand Down Expand Up @@ -78,20 +87,26 @@ def _update_build_number(version: str):

def set_ver(args: Dict[str, str]):
"""Update version number"""
new_version = _update_build_number(args["<ver>"])
build_version = _update_build_number(args["<ver>"])

# add wip to version if this is a wip build
is_wip = args.get("<build>", "release") == "wip"
if is_wip:
new_version += configs.PYREVIT_WIP_VERSION_EXT
build_version += configs.PYREVIT_WIP_VERSION_EXT

if VER_FINDER.match(new_version):
print(f"Updating version to v{new_version}...")
if VER_FINDER.match(build_version):
print(f"Updating version to v{build_version}...")
_modify_contents(
files=configs.VERSION_FILES,
finder=VER_FINDER,
new_value=new_version,
new_value=build_version,
)
install_version, _ = build_version.split("+")
print(f"Updating installers to v{install_version}...")
with open(configs.PYREVIT_INSTALL_VERSION_FILE, "w") as ivfile:
ivfile.writelines(install_version)

_modify_choco_nuspec(build_version, install_version)
else:
print(utils.colorize("<red>Invalid version format (e.g. 4.8.0)</red>"))
sys.exit(1)
Expand Down
27 changes: 19 additions & 8 deletions dev/scripts/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
LABS = op.join(DEVPATH, "pyRevitLabs/pyRevitLabs.sln")
DEFAULT_IPY = op.join(DEVPATH, "modules/pyRevitLabs.IronPython2.sln")
LOADERS = op.join(DEVPATH, "pyRevitLoader/pyRevitLoader.sln")
CPYTHONRUNTIME = op.join(
DEVPATH, "modules/pyRevitLabs.Python.Net.sln"
)
CPYTHONRUNTIME = op.join(DEVPATH, "modules/pyRevitLabs.Python.Net.sln")
DIRECTORY_BUILD_PROPS = op.join(DEVPATH, "Directory.Build.props")

# cli autocomplete files
USAGEPATTERNS = op.join(DEVPATH, "pyRevitLabs/pyRevitCLI/Resources/UsagePatterns.txt")
USAGEPATTERNS = op.join(
DEVPATH, "pyRevitLabs/pyRevitCLI/Resources/UsagePatterns.txt"
)
AUTOCOMPPATH = "dev/pyRevitLabs/pyRevitCLIAutoComplete"
AUTOCOMP = op.join(AUTOCOMPPATH, "pyrevit-autocomplete.go")
AUTOCOMPBIN = op.join(BINPATH, "pyrevit-autocomplete.exe")
Expand All @@ -38,6 +38,10 @@
DOCS_BUILD = op.join(DOCS_DIR, "_build")
DOCS_INDEX = op.join(DOCS_BUILD, "index.html")

# python module
PYREVIT_LIBS_PATH = op.join(ROOT, "pyrevitlib")
PYREVIT_MODULE_PATH = op.join(PYREVIT_LIBS_PATH, "pyrevit")

# release files
# API file paths must be absolute otherwise advancedinstaller will mess up
# the relative source paths defined inside the api file and fails
Expand Down Expand Up @@ -74,8 +78,15 @@
op.join(DISTRIBUTE_PATH, PYREVIT_CLI_ADMIN_INSTALLER_NAME),
]

# choco files
PYREVIT_CHOCO_NUSPEC_FILE = op.join(RELEASE_PATH, "choco", "pyrevit-cli.nuspec")
PYREVIT_CHOCO_INSTALL_FILE = op.join(
RELEASE_PATH, "choco/tools", "chocolateyinstall.ps1"
)

PYREVIT_WIP_VERSION_EXT = "-wip"
PYREVIT_VERSION_FILE = op.join(ROOT, "pyrevitlib/pyrevit/version")
PYREVIT_VERSION_FILE = op.join(PYREVIT_MODULE_PATH, "version")
PYREVIT_INSTALL_VERSION_FILE = op.join(RELEASE_PATH, "version")

# data files
PYREVIT_HOSTS_DATAFILE = op.join(BINPATH, "pyrevit-hosts.json")
Expand All @@ -94,7 +105,7 @@
# files containing copyright notice
COPYRIGHT_FILES = [
DIRECTORY_BUILD_PROPS,
op.join(ROOT, "pyrevitlib/pyrevit/versionmgr/about.py"),
op.join(PYREVIT_MODULE_PATH, "versionmgr/about.py"),
op.join(DOCS_DIR, "conf.py"),
op.join(ROOT, "README.md"),
PYREVIT_INSTALLERFILE,
Expand All @@ -107,7 +118,7 @@
AUTOCOMP,
DIRECTORY_BUILD_PROPS,
PYREVIT_VERSION_FILE,
op.join(ROOT, "pyrevitlib/pyrevit/versionmgr/about.py"),
op.join(PYREVIT_MODULE_PATH, "versionmgr/about.py"),
op.join(DOCS_DIR, "conf.py"),
op.join(ROOT, "README.md"),
r"release\*",
Expand All @@ -116,7 +127,7 @@

# all source file locations that are part of pyRevit project
SOURCE_DIRS = [
op.join(ROOT, "pyrevitlib/pyrevit"),
PYREVIT_MODULE_PATH,
DEVPATH,
]

Expand Down
4 changes: 0 additions & 4 deletions release/choco/choco-push.sh

This file was deleted.

65 changes: 7 additions & 58 deletions release/choco/pyrevit-cli.nuspec
Original file line number Diff line number Diff line change
@@ -1,82 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Read this before creating packages: https://chocolatey.org/docs/create-packages -->
<!-- It is especially important to read the above link to understand additional requirements when publishing packages to the community feed aka dot org (https://chocolatey.org/packages). -->

<!-- Test your packages in a test environment: https://github.com/chocolatey/chocolatey-test-environment -->

<!--
This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Reference. Chocolatey uses a special version of NuGet.Core that allows us to do more than was initially possible. As such there are certain things to be aware of:
* the package xmlns schema url may cause issues with nuget.exe
* Any of the following elements can ONLY be used by choco tools - projectSourceUrl, docsUrl, mailingListUrl, bugTrackerUrl, packageSourceUrl, provides, conflicts, replaces
* nuget.exe can still install packages with those elements but they are ignored. Any authoring tools or commands will error on those elements
-->

<!-- You can embed software files directly into packages, as long as you are not bound by distribution rights. -->
<!-- * If you are an organization making private packages, you probably have no issues here -->
<!-- * If you are releasing to the community feed, you need to consider distribution rights. -->
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<!-- == PACKAGE SPECIFIC SECTION == -->
<!-- This section is about this package, although id and version have ties back to the software -->
<!-- id is lowercase and if you want a good separator for words, use '-', not '.'. Dots are only acceptable as suffixes for certain types of packages, e.g. .install, .portable, .extension, .template -->
<!-- If the software is cross-platform, attempt to use the same id as the debian/rpm package(s) if possible. -->
<id>pyrevit-cli</id>
<!-- version should MATCH as closely as possible with the underlying software -->
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
<version>4.8.9.21361+0320</version>
<packageSourceUrl>https://github.com/eirannejad/pyRevit/tree/master/release/pyrevit-cli/</packageSourceUrl>
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
<!--<owners>Ehsan Iran-Nejad</owners>-->
<!-- ============================== -->

<!-- == SOFTWARE SPECIFIC SECTION == -->
<!-- This section is about the software itself -->
<version>4.8.9.21361</version>
<packageSourceUrl>https://github.com/eirannejad/pyRevit/tree/master/release/choco/</packageSourceUrl>
<owners>Ehsan Iran-Nejad</owners>
<title>pyRevit CLI</title>
<authors>Ehsan Iran-Nejad</authors>
<!-- projectUrl is required for the community feed -->
<projectUrl>https://github.com/eirannejad/pyRevit</projectUrl>
<iconUrl>https://github.com/eirannejad/pyRevit/tree/master/release/pyrevit-cli/chocoicon.png</iconUrl>
<iconUrl>https://github.com/eirannejad/pyRevit/tree/master/release/choco/chocoicon.png</iconUrl>
<copyright>(c) 2019 Ehsan Iran-Nejad</copyright>
<!-- If there is a license Url available, it is required for the community feed -->
<licenseUrl>https://github.com/eirannejad/pyRevit/blob/master/LICENSE.txt</licenseUrl>
<!-- <requireLicenseAcceptance>true</requireLicenseAcceptance> -->
<projectSourceUrl>https://github.com/eirannejad/pyRevit/tree/master/dev/pyRevitLabs</projectSourceUrl>
<docsUrl>https://github.com/eirannejad/pyRevit/blob/master/README_CLI.md</docsUrl>
<!--<mailingListUrl></mailingListUrl>-->
<docsUrl>https://github.com/eirannejad/pyRevit/blob/master/README.md</docsUrl>
<bugTrackerUrl>https://github.com/eirannejad/pyRevit/issues</bugTrackerUrl>
<tags>pyrevit-cli revit pyrevit</tags>
<summary>pyRevit Command Line Tool </summary>
<description>pyrevit cli is the command line tool, developed specifically to install
and configure pyRevit in your production/development environment.
Each section below showcases a specific set of functionality of the command line tool.
</description>
<releaseNotes>https://github.com/eirannejad/pyRevit/releases/tag/v4.8.9.21361%2B0320</releaseNotes>
<!-- =============================== -->

<!-- Specifying dependencies and version ranges? https://docs.nuget.org/create/versioning#specifying-version-ranges-in-.nuspec-files -->
<releaseNotes>https://github.com/eirannejad/pyRevit/releases/tag/v4.8.9.21361%2B0320/</releaseNotes>
<dependencies>
<dependency id="dotnetfx" version="4.8.0.20190930" />
<!-- <dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_INCLUSIVE]" />
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_EXCLUSIVE)" />
<dependency id="" />
<dependency id="chocolatey-core.extension" version="1.1.0" /> -->
</dependencies>
<!-- chocolatey-core.extension - https://chocolatey.org/packages/chocolatey-core.extension
- You want to use Get-UninstallRegistryKey on less than 0.9.10 (in chocolateyUninstall.ps1)
- You want to use Get-PackageParameters and on less than 0.11.0
- You want to take advantage of other functions in the core community maintainer's team extension package
-->

<!--<provides>NOT YET IMPLEMENTED</provides>-->
<!--<conflicts>NOT YET IMPLEMENTED</conflicts>-->
<!--<replaces>NOT YET IMPLEMENTED</replaces>-->
</metadata>
<files>
<!-- this section controls what actually gets packaged into the Chocolatey package -->
<file src="tools\**" target="tools" />
<!--Building from Linux? You may need this instead: <file src="tools/**" target="tools" />-->
</files>
</package>
4 changes: 2 additions & 2 deletions release/choco/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ $packageArgs = @{

softwareName = 'pyrevit-cli*'

checksum = '7ae3487a95f0859db33cceae395b0c51afe644cf88dc8d1366db1f608cbf558f'
checksum = '2558700AC3AAC08EFE930ABADF764A9B544E0BF981CD9245E4A4CF4E26F3A80A'
checksumType = 'sha256'
checksum64 = '7ae3487a95f0859db33cceae395b0c51afe644cf88dc8d1366db1f608cbf558f'
checksum64 = '2558700AC3AAC08EFE930ABADF764A9B544E0BF981CD9245E4A4CF4E26F3A80A'
checksumType64= 'sha256'

silentArgs = "/VERYSILENT"
Expand Down
1 change: 1 addition & 0 deletions release/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.8.9.21361

0 comments on commit 3bd9c6e

Please sign in to comment.