-
Notifications
You must be signed in to change notification settings - Fork 46
147 lines (130 loc) · 4.54 KB
/
publish-release-packages.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
140
141
142
143
144
145
146
147
name: Publish packages to public repositories
on:
workflow_call:
inputs:
artifactName:
required: true
type: string
description: "The github artifact holding the wheel file which will be published"
release_version:
required: true
type: string
description: "The release version that will be published (e.g. 0.1.0)"
do_brew:
required: false
default: true
type: boolean
description: "Publish to brew repository"
do_snap:
required: false
default: true
type: boolean
description: "Publish to snap repository"
do_winget:
required: false
default: true
type: boolean
description: "Publish to Winget repository"
workflow_dispatch:
inputs:
artifactName:
required: true
type: string
description: "The github artifact holding the wheel file which will be published"
release_version:
required: true
type: string
description: "The release version that will be published (e.g. 0.1.0)"
do_brew:
required: false
default: true
type: boolean
description: "Publish to brew repository"
do_snap:
required: false
default: true
type: boolean
description: "Publish to snap repository"
do_winget:
required: false
default: true
type: boolean
description: "Publish to Winget repository"
jobs:
publish-brew:
runs-on: ubuntu-latest
if: ${{ inputs.do_brew }}
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BOT_ID }}
private-key: ${{ secrets.BOT_SK }}
repositories: homebrew-tap
owner: algorandfoundation
- name: Checkout source code
uses: actions/checkout@v4
- name: Download wheel from release
run: gh release download v${{ inputs.release_version }} --pattern "*.whl" --dir dist
env:
GH_TOKEN: ${{ github.token }}
- name: Download binary artifact from release
run: gh release download v${{ inputs.release_version }} --pattern "*-brew.tar.gz" --dir dist
env:
GH_TOKEN: ${{ github.token }}
- name: Set Git user as GitHub actions
run: git config --global user.email "[email protected]" && git config --global user.name "github-actions"
- name: Update homebrew cask
run: scripts/update-brew-cask.sh "dist/algokit*-py3-none-any.whl" "dist/algokit*-macos_arm64-brew.tar.gz" "dist/algokit*-macos_x64-brew.tar.gz" "algorandfoundation/homebrew-tap"
env:
TAP_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
publish-winget:
runs-on: windows-latest
if: ${{ inputs.do_winget }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Publish to winget
shell: pwsh
env:
WINGET_GITHUB_TOKEN: ${{ secrets.WINGET_GITHUB_TOKEN }}
run: |
echo 'Publishing to winget'
& .\scripts\winget\update-package.ps1 `
-releaseVersion '${{ inputs.release_version }}'
publish-snap:
runs-on: ubuntu-latest
if: ${{ inputs.do_snap }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Download binary artifact from release
run: |
gh release download v${{ inputs.release_version }} --pattern "*-snap.tar.gz" --dir dist
BINARY_PATH=$(ls dist/*-snap.tar.gz)
echo "BINARY_PATH=$BINARY_PATH" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ github.token }}
- name: Generate snapcraft.yaml
run: |
./scripts/snap/create-snapcraft-yaml.sh ${{ github.workspace }} ${{ inputs.release_version }} ${{ env.BINARY_PATH }} "stable"
- name: Upload snapcraft.yaml as reference artifact
uses: actions/upload-artifact@v4
with:
name: snapcraft-yaml
path: ${{ github.workspace }}/snap/snapcraft.yaml
- name: Build snap
uses: snapcore/action-build@v1
with:
snapcraft-args: --target-arch amd64
- name: Set path to snap binary
shell: bash
run: |
echo "SNAP_BINARY_PATH=$(find ${{ github.workspace }} -name '*.snap')" >> $GITHUB_ENV
- name: Publish snap
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_RELEASE_TOKEN }}
with:
snap: ${{ env.SNAP_BINARY_PATH }}
release: stable