-
Notifications
You must be signed in to change notification settings - Fork 4
127 lines (111 loc) · 3.55 KB
/
Copy pathrelease.yml
File metadata and controls
127 lines (111 loc) · 3.55 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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # Run workflow on version tags, e.g. v1.0.0
permissions:
contents: write
jobs:
build:
name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
suffix: linux-amd64
- os: ubuntu-latest
goos: linux
goarch: arm64
suffix: linux-arm64
- os: macos-latest
goos: darwin
goarch: amd64
suffix: darwin-amd64
- os: macos-latest
goos: darwin
goarch: arm64
suffix: darwin-arm64
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Build frontend
shell: bash
run: |
cd web
rm -rf dist # Clean any old dist folders
npm ci
npm run build
# Show version folder created
echo "Built to: $(ls dist/)"
- name: Verify frontend build
shell: bash
run: |
echo "Checking web/dist contents..."
ls -la web/dist/
VERSION_DIR=$(ls web/dist/)
echo "Version folder: $VERSION_DIR"
echo "Contents of web/dist/$VERSION_DIR:"
ls -la "web/dist/$VERSION_DIR/"
echo "Verifying index.html exists..."
test -f "web/dist/$VERSION_DIR/index.html" || (echo "ERROR: index.html not found!" && exit 1)
echo "Frontend build verified successfully"
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
cache: false # Disable cache to ensure fresh embed of web/dist
- name: Build binary
shell: bash
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
# Force Go to see embed.go as modified so it re-embeds the dist folder
touch web/embed.go
# Clean any cached builds to ensure fresh embed
go clean -cache
# Build with fresh embed
go build -ldflags="-s -w -X github.com/SAP/astonish/cmd/astonish.Version=${{ github.ref_name }}" -o astonish-${{ matrix.suffix }} .
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: astonish-${{ matrix.suffix }}
path: astonish-${{ matrix.suffix }}
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: github.repository == 'SAP/astonish'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: ./artifacts
- name: Prepare release assets
run: |
mkdir -p release
# Move all binaries to release folder
find ./artifacts -type f -name "astonish-*" -exec mv {} ./release/ \;
# List files for verification
ls -la ./release/
# Make binaries executable
chmod +x ./release/astonish-linux-* ./release/astonish-darwin-* || true
- name: Create Release
uses: softprops/action-gh-release@v3
with:
files: ./release/*
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}