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

added chocolatey build #1712

Merged
merged 13 commits into from
Oct 16, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,30 @@ jobs:
# macOS notarization API key
API_KEY_ID: ${{ secrets.apple_api_key_id }}
API_KEY_ISSUER_ID: ${{ secrets.apple_api_key_issuer_id }}

# chocolatey
- name: Read VERSION file
id: getversion
run: echo "::set-output name=version::$(cat VERSION)"
- name: Add mask
run: |
echo "::add-mask::${{ secrets.CHOCOLATEY_API_KEY }}"
- name: chocolatey pack
if: startsWith(matrix.os, 'windows')
uses: crazy-max/ghaction-chocolatey@v1.6.0
with:
args: pack chocolatey\altair-graphql.nuspec
- name: chocolatey install (test choco packaging)
if: startsWith(matrix.os, 'windows')
uses: crazy-max/ghaction-chocolatey@v1.6.0
with:
args: install altair-graphql.${{ steps.getversion.outputs.version }}.nupkg
- name: chocolatey push
if: startsWith(matrix.os, 'windows')
uses: crazy-max/ghaction-chocolatey@v1.6.0
with:
args: push altair-graphql.${{ steps.getversion.outputs.version }}.nupkg -s https://push.chocolatey.org/ -k="'${{ secrets.CHOCOLATEY_API_KEY }}'"

npm-publish:
runs-on: ubuntu-latest
needs: electron
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.11
18 changes: 18 additions & 0 deletions bin/update_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ NEW_BASE="\"version\": \"$NEW_VERSION\""
CWEX_OLD_BASE=' version: .*'
CWEX_NEW_BASE=" version: $NEW_VERSION"

XML_OLD_BASE='<version>.*</version>'
XML_NEW_BASE="<version>$NEW_VERSION</version>"

PS1_OLD_BASE='altair_.*_x64_win'
PS1_NEW_BASE="altair_${NEW_VERSION}_x64_win"

VERSION_OLD_BASE='.*'
VERSION_NEW_BASE=$NEW_VERSION

# Update version in VERSION file
sed -i '' "s|$VERSION_OLD_BASE|$VERSION_NEW_BASE|g" ./VERSION

# Update version in manifest.json
sed -i '' "s|$OLD_BASE|$NEW_BASE|g" ./chrome-ext-files/manifest.json

Expand All @@ -22,6 +34,12 @@ sed -i '' "s|$OLD_BASE|$NEW_BASE|g" ./package.json
# Update version in cwex.yml
sed -i '' "s|$CWEX_OLD_BASE|$CWEX_NEW_BASE|g" ./cwex.yml

# Update version in altair-graphql.nuspec
sed -i '' "s|$XML_OLD_BASE|$XML_NEW_BASE|g" ./chocolatey/altair-graphql.nuspec

# Update version in altair-graphql.nuspec
sed -i '' "s|$PS1_OLD_BASE|$PS1_NEW_BASE|g" ./chocolatey/tools/chocolateyInstall.ps1

if (lerna --version); then
# Set the lerna packages versions as well
lerna version $NEW_VERSION --force-publish=* --no-git-tag-version --no-push --yes;
Expand Down
1 change: 1 addition & 0 deletions chocolatey/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.nupkg
16 changes: 16 additions & 0 deletions chocolatey/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# altair-graphql chocolatey

This package can be found in the [official Choclatey Repository](https://chocolatey.org/packages/altair-graphql)

# Usage
If you just want to install altair-graphql you can use the official Chocolatey Repository
``` shell script
choco install altair-graphql
```

# Build
If you want to build the chocolatey package yourself you can use the next commands
``` shell script
choco pack
choco install altair-graphql.4.0.11.nupkg
```
82 changes: 82 additions & 0 deletions chocolatey/altair-graphql.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?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. -->
<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>altair-graphql</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.0.11</version>
<packageSourceUrl>https://github.com/altair-graphql/altair</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>Daniel Richter&lt;danielrichter@posteo.de&gt;, Samuel Imolorhe</owners>
<!-- ============================== -->

<!-- == SOFTWARE SPECIFIC SECTION == -->
<!-- This section is about the software itself -->
<title>Altair GraphQL Client</title>
<authors>Samuel Imolorhe</authors>
<!-- projectUrl is required for the community feed -->
<projectUrl>https://github.com/altair-graphql/altair</projectUrl>
<!-- TODO: update when site is deployed with logo -->
<iconUrl>https://altair.sirmuel.design/favicon.ico</iconUrl>
<!-- <copyright>Year Software Vendor</copyright> -->
<!-- If there is a license Url available, it is required for the community feed -->
<licenseUrl>https://github.com/altair-graphql/altair/blob/staging/.github/LICENSE</licenseUrl>
<!-- <requireLicenseAcceptance>true</requireLicenseAcceptance>-->
<projectSourceUrl>https://github.com/imolorhe/altair</projectSourceUrl>
<docsUrl>https://github.com/altair-graphql/altair/blob/staging/chocolatey/README.md</docsUrl>
<!--<mailingListUrl></mailingListUrl>-->
<bugTrackerUrl>https://github.com/altair-graphql/altair/issues</bugTrackerUrl>
<tags>altair-graphql graphql graphql-client altair opensource graphql-editor graphql-ide graphiql graphql-subscriptions</tags>
<summary>✨⚡️ A beautiful feature-rich GraphQL Client for all platforms. https://altair.sirmuel.design/</summary>
<description>✨⚡️ A beautiful feature-rich GraphQL Client for all platforms. https://altair.sirmuel.design/</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" />
<file src="..\packages\altair-electron\out\**" target="bins" />
<!--Building from Linux? You may need this instead: <file src="tools/**" target="tools" />-->
</files>
</package>
20 changes: 20 additions & 0 deletions chocolatey/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$ErrorActionPreference = 'Stop'; # stop on all errors
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$fileLocation = Join-Path $toolsDir '..\bins\altair_4.0.11_x64_win.exe'

$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = $toolsDir
fileType = 'EXE'
file = $fileLocation
file64 = $fileLocation
softwareName = 'altair-graphql*'
checksum = '' # TODO: Figure this out
checksumType = 'sha256'
checksum64 = '' # TODO: Figure this out
checksumType64= 'sha256'
silentArgs = "/qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`""
validExitCodes= @(0, 3010, 1641)
}

Install-ChocolateyPackage @packageArgs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.