-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (113 loc) · 4.25 KB
/
release-only.yml
File metadata and controls
133 lines (113 loc) · 4.25 KB
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
name: Release Only
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.2)'
required: true
type: string
env:
GO_VERSION: '1.26.1'
jobs:
release:
name: Build & Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up Go (bootstrap)
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: 'stable'
cache: false
- name: Install Go ${{ env.GO_VERSION }}
run: |
go install golang.org/dl/go${{ env.GO_VERSION }}@latest
go${{ env.GO_VERSION }} download
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go
- name: Install azd
run: curl -fsSL https://aka.ms/install-azd.sh | bash
- name: Install azd extensions
run: |
azd extension source add azd --location https://aka.ms/azd/extensions/registry --type url 2>/dev/null || true
azd extension install microsoft.azd.extensions --source azd
- name: Update version in extension.yaml
working-directory: cli
run: |
sed -i "s/^version: .*/version: ${{ inputs.version }}/" extension.yaml
cat extension.yaml | grep version
- name: Build binaries
working-directory: cli
run: |
export EXTENSION_ID="jongio.azd.copilot"
export EXTENSION_VERSION="${{ inputs.version }}"
azd x build --all
- name: Package
working-directory: cli
run: azd x pack
- name: Debug - List build artifacts
run: |
echo "=== Checking registry directory ==="
ls -lah ~/.azd/registry/jongio.azd.copilot/ || echo "Registry directory not found"
echo ""
echo "=== Checking version directory ==="
ls -lah ~/.azd/registry/jongio.azd.copilot/${{ inputs.version }}/ || echo "Version directory not found"
echo ""
echo "=== Full tree of registry ==="
find ~/.azd/registry/jongio.azd.copilot/ -type f 2>/dev/null || echo "No files found in registry"
- name: Extract release notes
id: release_notes
run: |
VERSION="${{ inputs.version }}"
awk '
BEGIN { in_section = 0 }
/^## \['"$VERSION"'\]/ { in_section = 1; next }
/^## \[/ { in_section = 0 }
in_section && NF > 0 { print }
' CHANGELOG.md > /tmp/release-notes.md
echo "Release notes for v$VERSION:"
cat /tmp/release-notes.md
- name: Release
working-directory: cli
run: |
azd x release \
--repo "${{ github.repository }}" \
--version "${{ inputs.version }}" \
--notes-file /tmp/release-notes.md \
--confirm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update registry
working-directory: cli
run: |
cd ..
git pull
cd cli
azd x publish \
--registry ../registry.json \
--version "${{ inputs.version }}" \
--repo "${{ github.repository }}"
cd ..
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add registry.json
if ! git diff --cached --quiet; then
git commit -m "chore: update registry for v${{ inputs.version }}"
git push
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify azd-extensions
if: success()
run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.EXTENSIONS_DISPATCH_TOKEN }}" \
https://api.github.com/repos/jongio/azd-extensions/dispatches \
-d '{"event_type":"extension-released","client_payload":{"repo":"azd-copilot","version":"${{ inputs.version }}"}}'