This repository has been archived by the owner on Nov 25, 2022. It is now read-only.
generated from ipfs/ipfs-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (67 loc) · 2.23 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Release to Chocolatey
on:
workflow_dispatch:
inputs:
no-check-choco-version:
required: false
description: Disable version check in the Chocolatey community feed
concurrency:
group: single-run
cancel-in-progress: true
jobs:
check:
runs-on: windows-latest
outputs:
publish: ${{ steps.new-version-check.outputs.publish }}
defaults:
run:
shell: bash
steps:
- name: Find the latest version on Chocolatey
run: choco search go-ipfs --exact | grep go-ipfs | awk '{ print $2 }' | tee choco-version
- name: Find the latest version on dist.ipfs.io
run: curl -s https://dist.ipfs.io/go-ipfs/versions | egrep "^v[0-9]+\.[0-9]+\.[0-9]+$" | tail -1 | cut -c 2- | tee dist-version
- name: Check if the latest version is already published
id: new-version-check
run: |
diff choco-version dist-version || true
if cmp -s choco-version dist-version; then
echo "::set-output name=publish::false"
exit
fi
echo "::set-output name=publish::true"
publish:
runs-on: windows-latest
needs: check
if: needs.check.outputs.publish == 'true'
environment: chocolatey
defaults:
run:
shell: pwsh
working-directory: ./go-ipfs
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Dependencies
run: choco install au
- name: Build the latest release 🏗️
env:
NoCheckChocoVersion: ${{ github.event.inputs.no-check-choco-version || 'False' }}
run: |
./update.ps1
choco pack
# if ./update.ps1 fails for any reason a bogus package
# go-ipfs.0.0.0.nupkg is created.
# we skip publishing when that happens.
- name: Check if ok to proceed with publishing
id: check
run: |
if test -e go-ipfs.0.0.0.nupkg; then
echo "::set-output name=ok::false"
exit
fi
echo "::set-output name=ok::true"
shell: bash
- name: Publish to Chocolatey 🍫
if: ${{ steps.check.outputs.ok == 'true' }}
run: choco push --key ${{ secrets.chocolatey_key }} --source "https://push.chocolatey.org"