-
Notifications
You must be signed in to change notification settings - Fork 6
66 lines (59 loc) · 2.27 KB
/
scoop.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
name: Update Scoop
on:
workflow_run:
workflows: ["Release naisdevice"]
types:
- completed
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-scoop:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Get Latest version
id: latest_version
uses: abatilo/release-info-action@5774bec4e3eabad433b4ae8f625e83afa0e7bb22
with:
owner: nais
repo: device
- uses: navikt/github-app-token-generator@v1
id: get-scoop-token
with:
private-key: ${{ secrets.NAIS_APP_PRIVATE_KEY }}
app-id: ${{ secrets.NAIS_APP_ID }}
repo: nais/scoop-bucket
- name: Checkout scoop-bucket
uses: actions/checkout@v3
with:
repository: nais/scoop-bucket
token: ${{ steps.get-scoop-token.outputs.token }}
path: bucket
- name: Update version and checksum in manifest
id: update_manifest
env:
LATEST: ${{ steps.latest_version.outputs.latest_tag }}
LATEST_DATE: ${{ steps.latest_version.outputs.latest_tag_published_at }}
SCOOP_TOKEN: ${{ steps.get-scoop-token.outputs.token }}
run: |
echo "Version ${LATEST} was released at ${LATEST_DATE}"
if [[ "${LATEST}" == "null" ]]; then
echo "Invalid version!"
exit 1
fi
cd bucket
git config user.email "[email protected]"
git config user.name "naisdevice pipeline"
for exe in naisdevice naisdevice-tenant ; do
url=https://github.com/nais/device/releases/download/${LATEST}/${exe}.exe
update_url=https://github.com/nais/device/releases/download/\$version/${exe}.exe
checksum=$(curl --location ${url}.sha256)
jq ".architecture[\"64bit\"].url = \"${url}\" | .architecture[\"64bit\"].hash = \"${checksum}\" | .version = \"${LATEST}\" | .autoupdate[\"64bit\"].url = \"${update_url}\"" ../packaging/windows/scoop-template.json > ${exe}.json
done
git add naisdevice*.json
if ! git --no-pager diff --cached --exit-code; then
git commit -a -m "Bump naisdevice version to ${LATEST}"
git push
fi