Skip to content

Commit 8201a02

Browse files
authored
feat: automated Chocolatey publishing (#1697)
1 parent 42bab7c commit 8201a02

File tree

4 files changed

+52
-12
lines changed

4 files changed

+52
-12
lines changed

.github/workflows/chocolatey.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: chocolatey
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
9+
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron
10+
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder
11+
release_name: ${{ github.event.release.name }}
12+
release_tag: ${{ github.event.release.tag_name }}
13+
14+
jobs:
15+
publish:
16+
runs-on: windows-latest
17+
18+
steps:
19+
- name: Check out Git repository
20+
uses: actions/checkout@v1
21+
22+
- name: Install Node.js for update script
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: 12.x
26+
27+
- name: Cache bigger downloads
28+
uses: actions/cache@v2
29+
id: cache
30+
with:
31+
path: ${{ github.workspace }}/.cache
32+
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
33+
restore-keys: |
34+
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
35+
${{ runner.os }}-
36+
37+
- name: Install dependencies
38+
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
39+
40+
- name: Download .exe, update version, URL and hash
41+
run: node pkgs\chocolatey\update.js ${{ env.release_name }}
42+
43+
- name: Create .nupkg
44+
run: cd pkgs\chocolatey && choco pack
45+
46+
- name: Publish to Chocolatey
47+
run: choco push pkgs/chocolatey/ipfs-desktop.${{ env.release_name }}.nupkg --key ${{ secrets.chocolatey_key }} --source "https://push.chocolatey.org"

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ jobs:
104104
# Apple signing
105105
mac_certs: ${{ secrets.mac_certs }}
106106
mac_certs_password: ${{ secrets.mac_certs_password }}
107-
# TODO: secrets forsnap, chocolatey
108107
env:
109108
CI_BUILD_TAG: ${{steps.tag.outputs.tag}} # used by --publish onTag
110109
# Apple notarization

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,8 @@ Other languages are periodically pulled from [Transifex](https://www.transifex.c
136136
- Update links and badges in `README.md` to point to the new version (`A.B.C`)
137137
- Update `CHANGELOG.md` with details from release/release draft
138138
- Update selected package managers
139-
- Wait for Github Action to finish and confirm it updated [Snap](https://snapcraft.io/ipfs-desktop).
139+
- 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).
140140
- Update [Homebrew Cask](https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#updating-a-cask).
141-
- Update Chocolatey package:
142-
1. Wait for the artefact on the [releases page](https://github.com/ipfs-shipyard/ipfs-desktop/releases)
143-
2. Run `node pkgs/chocolatey/update.js A.B.C` - this script will update version to `A.B.C` in a few files:
144-
1. Update the version number on [ipfs-desktop.nuspec](./pkgs/chocolatey/ipfs-desktop.nuspec#L5)
145-
2. Update the binary URL on [chocolateyinstall.ps1](./pkgs/chocolatey/tools/chocolateyinstall.ps1#L3)
146-
3. Update the SHA256 of the binary on [chocolateyinstall.ps1](./pkgs/chocolatey/tools/chocolateyinstall.ps1#L4)
147-
3. Next, create `.nupkg` file and publish it:
148-
1. `cd pkgs/chocolatey`
149-
2. `choco pack` - generates a `.nupkg` file.
150-
3. `choco push $generated_nupkg --key $api --source https://push.chocolatey.org`
151141
- To start work on the next version, bump the version in the `package.json`
152142

153143
### Manual notarization (Fallback in-case CI is not doing it correctly)

pkgs/chocolatey/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Chocolatey Publishing
2+
3+
- IPFS Desktop is available at https://chocolatey.org/packages/ipfs-desktop
4+
- 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 commit comments

Comments
 (0)