@@ -14,39 +14,82 @@ jobs:
14
14
release :
15
15
runs-on : ubuntu-latest
16
16
steps :
17
- - name : setup python
18
- uses : actions/setup-python@v2
19
- with :
20
- python-version : 3.8
21
-
22
17
- uses : actions/checkout@v2
23
18
24
19
- uses : azure/login@v1
25
20
with :
26
21
creds : ${{ secrets.AZURE_CREDENTIALS }}
27
22
28
- - name : ' Download Repo Client'
23
+ - name : " Download Repo Client"
29
24
env :
30
25
AZ_SUB : ${{ secrets.AZURE_SUBSCRIPTION }}
31
26
run : |
32
27
az storage blob download --subscription "$AZ_SUB" --account-name gitcitoolstore -c tools -n azure-repoapi-client_2.0.1_amd64.deb -f repoclient.deb --auth-mode login
33
28
34
29
- name : " Install Repo Client"
35
- env :
36
- APT_REPO_ID : ${{ secrets.APT_REPO_ID }}
37
- AZURE_AAD_ID : ${{ secrets.AZURE_AAD_ID }}
38
- AAD_CLIENT_SECRET : ${{ secrets.AAD_CLIENT_SECRET }}
39
30
run : |
40
31
sudo apt-get install python3-adal --yes
41
32
sudo dpkg -i repoclient.deb
42
- python .github/configure_repoclient.py
43
33
rm repoclient.deb
44
34
35
+ - name : " Configure Repo Client"
36
+ uses : actions/github-script@v3
37
+ env :
38
+ AZURE_AAD_ID : ${{ secrets.AZURE_AAD_ID }}
39
+ AAD_CLIENT_SECRET : ${{ secrets.AAD_CLIENT_SECRET }}
40
+ with :
41
+ script : |
42
+ for (const key of ['AZURE_AAD_ID', 'AAD_CLIENT_SECRET']) {
43
+ if (!process.env[key]) throw new Error(`Required env var ${key} is missing!`)
44
+ }
45
+ const config = {
46
+ AADResource: 'https://microsoft.onmicrosoft.com/945999e9-da09-4b5b-878f-b66c414602c0',
47
+ AADTenant: '72f988bf-86f1-41af-91ab-2d7cd011db47',
48
+ AADAuthorityUrl: 'https://login.microsoftonline.com',
49
+ server: 'azure-apt-cat.cloudapp.net',
50
+ port: '443',
51
+ AADClientId: process.env.AZURE_AAD_ID,
52
+ AADClientSecret: process.env.AAD_CLIENT_SECRET,
53
+ repositoryId: ''
54
+ }
55
+ const fs = require('fs')
56
+ fs.writeFileSync('config.json', JSON.stringify(config, null, 2))
57
+
58
+ - name : " Get Release Asset"
59
+ id : get-asset
60
+ env :
61
+ RELEASE : ${{ github.event.inputs.release }}
62
+ uses : actions/github-script@v3
63
+ with :
64
+ github-token : ${{secrets.GITHUB_TOKEN}}
65
+ script : |
66
+ const { data } = await github.repos.getRelease({
67
+ owner: context.repo.owner,
68
+ repo: context.repo.repo,
69
+ release_id: process.env.RELEASE || 'latest'
70
+ })
71
+ const assets = data.assets.filter(asset => asset.name.endsWith('.deb'))
72
+ if (assets.length !== 1) {
73
+ throw new Error(`Unexpected number of .deb assets: ${assets.length}`)
74
+ }
75
+ const fs = require('fs')
76
+ const buffer = await github.repos.getReleaseAsset({
77
+ headers: {
78
+ accept: 'application/octet-stream'
79
+ },
80
+ owner: context.repo.owner,
81
+ repo: context.repo.repo,
82
+ asset_id: assets[0].id
83
+ })
84
+ console.log(buffer)
85
+ fs.writeFileSync(assets[0].name, Buffer.from(buffer.data))
86
+ core.setOutput('name', assets[0].name)
87
+
45
88
- name : " Publish to apt feed"
46
89
env :
47
90
RELEASE : ${{ github.event.inputs.release }}
48
91
run : |
49
- pip install requests
50
- python .github/fetch_release.py
51
- wget "$(cat asset_url.txt)"
52
- repoclient -v v3 -c config.json package add --check --wait 300 "$(cat asset_name.txt)"
92
+ for id in ${{ secrets.BIONIC_REPO_ID }} ${{ secrets.HIRSUTE_REPO_ID }}
93
+ do
94
+ repoclient -v v3 -c config.json package add --check --wait 300 "${{steps.get-asset.outputs.name}}" -r $id
95
+ done
0 commit comments