Skip to content

Commit 4d73ecc

Browse files
jongioCopilot
andcommitted
ci: add latest build workflow for continuous pre-releases
Produces installable binaries from main on every push to cli/**, updating a pinned 'latest' pre-release on GitHub Releases. Users can install with: azd extension install jongio.azd.app --version latest Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1e5e091 commit 4d73ecc

1 file changed

Lines changed: 137 additions & 0 deletions

File tree

.github/workflows/latest.yml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Latest Build
2+
3+
# Produces installable binaries from main on every push.
4+
# Downloads are available at: https://github.com/jongio/azd-app/releases/tag/latest
5+
6+
on:
7+
push:
8+
branches: [main]
9+
paths:
10+
- 'cli/**'
11+
- '.github/workflows/latest.yml'
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: latest-build
16+
cancel-in-progress: true
17+
18+
permissions:
19+
contents: write
20+
21+
defaults:
22+
run:
23+
shell: bash
24+
working-directory: cli
25+
26+
env:
27+
GO_VERSION: '1.26.3'
28+
29+
jobs:
30+
build:
31+
name: Build Latest
32+
runs-on: ubuntu-latest
33+
timeout-minutes: 20
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
37+
38+
- name: Set up Go
39+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
40+
with:
41+
go-version: '${{ env.GO_VERSION }}'
42+
cache: true
43+
cache-dependency-path: cli/go.sum
44+
45+
- name: Set up Node.js
46+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
47+
with:
48+
node-version: '22'
49+
50+
- name: Install pnpm
51+
uses: pnpm/action-setup@5b4374b04084dc1f9032b52464284b769ac5059e # v4
52+
with:
53+
version: 9
54+
55+
- name: Build dashboard
56+
run: |
57+
cd dashboard
58+
pnpm install
59+
pnpm run build
60+
61+
- name: Install azd
62+
run: curl -fsSL https://aka.ms/install-azd.sh | bash
63+
64+
- name: Install azd extensions
65+
run: |
66+
azd extension source add azd --location https://aka.ms/azd/extensions/registry --type url 2>/dev/null || true
67+
azd extension install microsoft.azd.extensions --source azd
68+
69+
- name: Build binaries
70+
run: |
71+
export EXTENSION_ID="jongio.azd.app"
72+
export EXTENSION_VERSION="0.0.0-dev.$(date +%Y%m%d).$(echo $GITHUB_SHA | cut -c1-7)"
73+
azd x build --all
74+
75+
- name: Package
76+
run: azd x pack
77+
78+
- name: Prepare release assets
79+
id: assets
80+
run: |
81+
echo "sha_short=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT
82+
echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
83+
# List what was built
84+
echo "=== Build output ==="
85+
find output/ -type f 2>/dev/null || find bin/ -type f 2>/dev/null || echo "No output found"
86+
87+
- name: Update latest release
88+
env:
89+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
run: |
91+
cd ..
92+
SHA_SHORT="${{ steps.assets.outputs.sha_short }}"
93+
BUILD_DATE="${{ steps.assets.outputs.date }}"
94+
95+
cat > /tmp/release-notes.md << 'EOF'
96+
## Latest Build from `main`
97+
98+
**Commit:** [`${{ steps.assets.outputs.sha_short }}`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
99+
**Built:** ${{ steps.assets.outputs.date }}
100+
101+
---
102+
103+
> ⚠️ This is an automatically-built pre-release from the `main` branch.
104+
> It may contain bugs. For stable releases, see the [Releases page](https://github.com/${{ github.repository }}/releases).
105+
106+
### Install
107+
108+
```bash
109+
azd extension install jongio.azd.app --version latest
110+
```
111+
EOF
112+
113+
# Delete existing latest release (if any) to recreate it
114+
gh release delete latest --yes --cleanup-tag 2>/dev/null || true
115+
116+
# Find the packed assets
117+
ASSETS=$(find cli/output/ -type f 2>/dev/null)
118+
if [ -z "$ASSETS" ]; then
119+
echo "No assets found in cli/output/, checking cli/bin/..."
120+
ASSETS=$(find cli/bin/ -type f 2>/dev/null)
121+
fi
122+
123+
if [ -n "$ASSETS" ]; then
124+
# Create release with assets
125+
echo "$ASSETS" | xargs gh release create latest \
126+
--title "Latest Build (${SHA_SHORT})" \
127+
--notes-file /tmp/release-notes.md \
128+
--prerelease \
129+
--target "${{ github.sha }}"
130+
else
131+
# Create release without assets (shouldn't happen but be safe)
132+
gh release create latest \
133+
--title "Latest Build (${SHA_SHORT})" \
134+
--notes-file /tmp/release-notes.md \
135+
--prerelease \
136+
--target "${{ github.sha }}"
137+
fi

0 commit comments

Comments
 (0)