-
Notifications
You must be signed in to change notification settings - Fork 39
50 lines (41 loc) · 2.13 KB
/
choco.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
---
name: "Chocolatey Release Pipeline"
on:
release:
types: [released]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Checkout tofuutils/chocolatey-packages'
uses: actions/checkout@v4
with:
repository: tofuutils/chocolatey-packages
ssh-key: ${{ secrets.CHOCOLATEY_SSH_KEY }}
- name: Update chocolatey checksums
run: |
echo "[INFO] Wait until all artefacts will be uploaded"
sleep 300
release_tag=${{ github.event.release.tag_name }}
release_version="${release_tag#v}"
echo "[INFO] Download release's checksums"
curl \
-SsL \
-o /tmp/checksums.txt \
https://github.com/tofuutils/tenv/releases/download/${release_tag}/tenv_${release_tag}_checksums.txt
echo "[INFO] Update chocolateyinstall.ps1"
choco_url="https://github.com/tofuutils/tenv/releases/download/${release_tag}/tenv_${release_tag}_Windows_i386.zip"
choco_url64="https://github.com/tofuutils/tenv/releases/download/${release_tag}/tenv_${release_tag}_Windows_x86_64.zip"
choco_sum="$(grep "tenv_${release_tag}_Windows_i386.zip" /tmp/checksums.txt | cut -d ' ' -f 1 | tr -d '\n')"
choco_sum64="$(grep "tenv_${release_tag}_Windows_x86_64.zip" /tmp/checksums.txt | cut -d ' ' -f 1 | tr -d '\n')"
sed -i "s~\$url = '.*'~\$url = '${choco_url}'~g" tenv/tools/chocolateyinstall.ps1
sed -i "s~\$url64 = '.*'~\$url64 = '${choco_url64}'~g" tenv/tools/chocolateyinstall.ps1
sed -i "s~\$checksum = '.*'~\$checksum = '${choco_sum}'~g" tenv/tools/chocolateyinstall.ps1
sed -i "s~\$checksum64 = '.*'~\$checksum64 = '${choco_sum64}'~g" tenv/tools/chocolateyinstall.ps1
echo "[INFO] Push changes back to git"
git config user.name tofuutils
git config user.email tofuutils@github.com
git add -A
git commit -m "Chocolatey scripts update for tenv version ${release_tag}"
git tag -a ${release_version} -m "${release_version}"
git push origin --tags main