Skip to content

Commit

Permalink
feat: automated Chocolatey publishing (#1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Oct 14, 2020
1 parent 42bab7c commit 8201a02
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 12 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/chocolatey.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: chocolatey

on:
release:
types: [published]

env:
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder
release_name: ${{ github.event.release.name }}
release_tag: ${{ github.event.release.tag_name }}

jobs:
publish:
runs-on: windows-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v1

- name: Install Node.js for update script
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Cache bigger downloads
uses: actions/cache@v2
id: cache
with:
path: ${{ github.workspace }}/.cache
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
${{ runner.os }}-
- name: Install dependencies
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm

- name: Download .exe, update version, URL and hash
run: node pkgs\chocolatey\update.js ${{ env.release_name }}

- name: Create .nupkg
run: cd pkgs\chocolatey && choco pack

- name: Publish to Chocolatey
run: choco push pkgs/chocolatey/ipfs-desktop.${{ env.release_name }}.nupkg --key ${{ secrets.chocolatey_key }} --source "https://push.chocolatey.org"
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ jobs:
# Apple signing
mac_certs: ${{ secrets.mac_certs }}
mac_certs_password: ${{ secrets.mac_certs_password }}
# TODO: secrets forsnap, chocolatey
env:
CI_BUILD_TAG: ${{steps.tag.outputs.tag}} # used by --publish onTag
# Apple notarization
Expand Down
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,8 @@ Other languages are periodically pulled from [Transifex](https://www.transifex.c
- Update links and badges in `README.md` to point to the new version (`A.B.C`)
- Update `CHANGELOG.md` with details from release/release draft
- Update selected package managers
- Wait for Github Action to finish and confirm it updated [Snap](https://snapcraft.io/ipfs-desktop).
- Wait for CI to finish and confirm it updated [Snap](https://snapcraft.io/ipfs-desktop) and is at least pending review on [Chocolatey](https://chocolatey.org/packages/ipfs-desktop#versionhistory).
- Update [Homebrew Cask](https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#updating-a-cask).
- Update Chocolatey package:
1. Wait for the artefact on the [releases page](https://github.com/ipfs-shipyard/ipfs-desktop/releases)
2. Run `node pkgs/chocolatey/update.js A.B.C` - this script will update version to `A.B.C` in a few files:
1. Update the version number on [ipfs-desktop.nuspec](./pkgs/chocolatey/ipfs-desktop.nuspec#L5)
2. Update the binary URL on [chocolateyinstall.ps1](./pkgs/chocolatey/tools/chocolateyinstall.ps1#L3)
3. Update the SHA256 of the binary on [chocolateyinstall.ps1](./pkgs/chocolatey/tools/chocolateyinstall.ps1#L4)
3. Next, create `.nupkg` file and publish it:
1. `cd pkgs/chocolatey`
2. `choco pack` - generates a `.nupkg` file.
3. `choco push $generated_nupkg --key $api --source https://push.chocolatey.org`
- To start work on the next version, bump the version in the `package.json`

### Manual notarization (Fallback in-case CI is not doing it correctly)
Expand Down
4 changes: 4 additions & 0 deletions pkgs/chocolatey/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Chocolatey Publishing

- IPFS Desktop is available at https://chocolatey.org/packages/ipfs-desktop
- Scripts present in this directory are automatically executed at CI after a new release is tagged ([#1697](https://github.com/ipfs-shipyard/ipfs-desktop/pull/1697))

0 comments on commit 8201a02

Please sign in to comment.