diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fae3266368c..2c89619c92a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index ec4a0f23ad9..17f1cdb8097 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk + +# Choco files that should get ignored +ignore.* diff --git a/dist/choco/pacaptr.template.nuspec b/dist/choco/pacaptr.template.nuspec new file mode 100644 index 00000000000..32d72c6f4ef --- /dev/null +++ b/dist/choco/pacaptr.template.nuspec @@ -0,0 +1,67 @@ + + + + + pacaptr + {version} + https://github.com/rami3l/pacaptr + Rami3L + + + + + pacaptr (Install) + Rami3L + + https://github.com/rami3l/pacaptr + + 2020 Rami3L + + https://opensource.org/licenses/MIT + false + https://github.com/rami3l/pacaptr + + + https://github.com/rami3l/pacaptr/issues + pacaptr pacman + Pacman syntax wrapper for homebrew, chocolatey, apt, and more. + + # 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`. + + + + + + + + + + + + + + + + + + diff --git a/dist/choco/tools/.gitkeep b/dist/choco/tools/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d