Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto submission for Chocolatey #6

Merged
merged 18 commits into from
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 58 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ jobs:
- name: Get url
id: url
env:
URL_MAC: https://github.com/rami3l/pacaptr/releases/download/${{ steps.ver.outputs.tag }}/${{ steps.binaries.outputs.mac }}
URL_LINUX: https://github.com/rami3l/pacaptr/releases/download/${{ steps.ver.outputs.tag }}/${{ steps.binaries.outputs.linux }}
URL_MAC: https://github.com/${{ github.repository }}/releases/download/${{ steps.ver.outputs.tag }}/${{ steps.binaries.outputs.mac }}
URL_LINUX: https://github.com/${{ github.repository }}/releases/download/${{ steps.ver.outputs.tag }}/${{ steps.binaries.outputs.linux }}
run: |
echo ::set-output name=mac::$URL_MAC
echo ::set-output name=linux::$URL_LINUX
Expand Down Expand Up @@ -171,3 +171,59 @@ jobs:
asset_name: "pacaptr.rb"
tag: ${{ github.ref }}
overwrite: true

# this scripts packs up a Chocolatey package and pushes it to Choco repository
publish-choco:
name: Publish app on Chocolatey
runs-on: windows-latest
needs: [publish-non-linux]
# if: ${{ secrets.CHOCO_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Get the version
id: ver
run: import re; print('::set-output name=tag::{}'.format(re.sub('refs/\w+/', '' ,'${{ github.ref }}')))
shell: python

- name: Download release
run: iwr https://github.com/${{ github.repository }}/releases/download/${{ steps.ver.outputs.tag }}/pacaptr-windows-amd64.tar.gz -OutFile ./release.tar.gz

- name: Extract release
run: tar xvf ./release.tar.gz -C ./dist/choco/tools/

- name: Add license
run: cp LICENSE dist/choco/tools/

- name: Replace variables in template
id: replace
shell: python
run: |
import re
from xml.sax.saxutils import escape
version = re.sub('refs/\w+/', '', '${{ github.ref }}')
# with open('README.md', 'r', encoding='utf8') as desc_file:
# description = desc_file.read()
with open(
'dist/choco/pacaptr.template.nuspec', 'r',
encoding='utf8') as template_file:
template = template_file.read()
template = re.sub('\{version\}', escape(version), template)
# template = re.sub('\{description\}', escape(description), template)
with open('dist/choco/pacaptr.nuspec', 'w', encoding='utf8') as output:
output.write(template)

- name: Check nuget template
run: |
echo "NuGet spec file:"
cat dist/choco/pacaptr.nuspec

- name: Set choco api key
run: choco apikey --key ${{ secrets.CHOCO_API_KEY }} --source https://push.chocolatey.org --verbose

- name: Pack up NuGet package
run: choco pack dist/choco/pacaptr.nuspec --verbose

- name: Push to choco repository
run: choco push pacaptr.${{ steps.ver.outputs.tag }}.nupkg --source https://push.chocolatey.org --verbose
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# Choco files that should get ignored
ignore.*
67 changes: 67 additions & 0 deletions dist/choco/pacaptr.template.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>pacaptr</id>
<version>{version}</version>
<packageSourceUrl>https://github.com/rami3l/pacaptr</packageSourceUrl>
<owners>Rami3L</owners>
<!-- ============================== -->

<!-- == SOFTWARE SPECIFIC SECTION == -->
<!-- This section is about the software itself -->
<title>pacaptr (Install)</title>
<authors>Rami3L</authors>
<!-- projectUrl is required for the community feed -->
<projectUrl>https://github.com/rami3l/pacaptr</projectUrl>
<!--<iconUrl>http://cdn.rawgit.com/__REPLACE_YOUR_REPO__/master/icons/pacaptr.png</iconUrl>-->
<copyright>2020 Rami3L</copyright>
<!-- If there is a license Url available, it is required for the community feed -->
<licenseUrl>https://opensource.org/licenses/MIT</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectSourceUrl>https://github.com/rami3l/pacaptr</projectSourceUrl>
<!--<docsUrl>At what url are the software docs located?</docsUrl>-->
<!--<mailingListUrl></mailingListUrl>-->
<bugTrackerUrl>https://github.com/rami3l/pacaptr/issues</bugTrackerUrl>
<tags>pacaptr pacman</tags>
<summary>Pacman syntax wrapper for homebrew, chocolatey, apt, and more.</summary>
<description>
# pacaptr

`pacaptr` is a Rust port of [icy/pacapt], a wrapper for many package managers with pacman-style command syntax.

Run `pacaptr -Syu` on the distro of your choice!

![Interface Concept](https://user-images.githubusercontent.com/33851577/83973021-2f876b00-a916-11ea-9c7e-9cb76ca27a0e.png)

> \- It's nice, but wait, why `reinstall`?
> \- To be more like `pacman`! Use `-S --needed` to `install`.
</description>
<!-- <releaseNotes>__REPLACE_OR_REMOVE__MarkDown_Okay</releaseNotes> -->
<!-- =============================== -->

<!-- Specifying dependencies and version ranges? https://docs.nuget.org/create/versioning#specifying-version-ranges-in-.nuspec-files -->
<!--<dependencies>
<dependency id="" version="__MINIMUM_VERSION__" />
<dependency id="" version="[__EXACT_VERSION__]" />
<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>
Empty file added dist/choco/tools/.gitkeep
Empty file.