-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (129 loc) · 4.43 KB
/
release-upload-asset.yaml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Upload Windows MSI to Dolt Release
on:
repository_dispatch:
types: [ upload-msi ]
workflow_dispatch:
inputs:
version:
description: 'SemVer format dolt release tag, i.e. 0.24.5'
required: true
commitish:
description: 'the dolt commit used to build the msi. if provided, used instead of version number'
required: false
default: ''
jobs:
get-release-id:
name: Get Dolt Release Id
runs-on: ubuntu-22.04
outputs:
release_id: ${{ steps.get_release.outputs.release_id }}
steps:
- name: Get Release
id: get_release
run: |
release_id="$RELEASE_ID"
if [ "$EVENT_TYPE" == "workflow_dispatch" ]; then
release_id=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/dolthub/dolt/releases/tags/v${{ github.event.inputs.version }} | jq '.id')
fi
echo "::set-output name=release_id::$release_id"
env:
EVENT_TYPE: ${{ github.event_name }}
RELEASE_ID: ${{ github.event.client_payload.release_id }}
get-version:
name: Get Version
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version
id: get_version
run: |
version=""
if [ "${{ github.event_name }}" == "repository_dispatch" ]
then
version="${{ github.event.client_payload.tag }}"
else
version="${{ github.event.inputs.version }}"
fi
echo "::set-output name=version::$version"
build-release-binaries:
needs: get-version
name: Build Release Binaries
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
repository: dolthub/dolt
ref: ${{ github.event.inputs.commitish || format('v{0}', needs.get-version.outputs.version) }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Build Binaries
run: |
GO_BUILD_VERSION=1.21 go/utils/publishrelease/buildbinaries.sh
- uses: actions/upload-artifact@v2
with:
name: dolt-windows-amd64-latest
path: go/out/dolt-windows-amd64.zip
upload-windows-msi:
needs: [get-version, get-release-id, build-release-binaries]
name: Upload Windows MSI to Dolt Release
runs-on: windows-2019
defaults:
run:
shell: powershell
steps:
- uses: actions/checkout@v2
- name: Build Windows MSI
run: |
mkdir archives
mkdir output
- uses: actions/download-artifact@v2
with:
name: dolt-windows-amd64-latest
path: archives/dolt-windows-amd64.zip
- name: Run Process.bat
run: |
./process.bat
- name: Upload MSI to Dolt Release
uses: actions/github-script@v4
with:
debug: true
github-token: ${{ secrets.REPO_ACCESS_TOKEN }}
script: |
const fs = require('fs');
const path = require('path')
try {
const data = fs.readFileSync(path.join(process.env.WORKSPACE, "output", "dolt-windows-amd64.msi"))
const res = await github.repos.uploadReleaseAsset({
owner: "dolthub",
repo: "dolt",
name: "dolt-windows-amd64.msi",
release_id: parseInt(process.env.RELEASE_ID, 10),
data,
});
console.log("Successfully uploaded windows msi", res)
} catch (err) {
console.log("Error", err);
process.exit(1);
}
env:
WORKSPACE: ${{ github.workspace }}
RELEASE_ID: ${{ needs.get-release-id.outputs.release_id }}
bump-dolt-packages:
needs: [get-version, upload-windows-msi]
runs-on: ubuntu-22.04
steps:
- name: Trigger Bump Winget
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: bump-winget
repository: dolthub/dolt
client-payload: '{"version": "${{ needs.get-version.outputs.version }}"}'
- name: Trigger Bump Chocolatey
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: bump-chocolatey
repository: dolthub/chocolatey-packages
client-payload: '{"version": "${{ needs.get-version.outputs.version }}"}'