-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (113 loc) · 3.65 KB
/
release-github.yml
File metadata and controls
132 lines (113 loc) · 3.65 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
name: Github Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Git
run: |
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: 2.x
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y gnupg zip unzip
- name: Install Git LFS
run: |
sudo apt-get install -y git-lfs
git lfs install
- name: Run tests
run: deno task test
build-and-release:
needs: test
runs-on: ubuntu-latest
# Add explicit permissions for releases
permissions:
contents: write
discussions: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: 2.x
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y zip unzip tar
- name: Install Git LFS
run: |
sudo apt-get install -y git-lfs
git lfs install
- name: Get tag name
id: get_tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Get commit message
id: get_commit_message
run: |
COMMIT_MSG=$(git log -1 --pretty=format:%B ${{ github.sha }})
# Properly handle multiline commit messages for GitHub Actions
echo "$COMMIT_MSG" > RELEASE_NOTES.txt
echo "NOTES_FILE=RELEASE_NOTES.txt" >> $GITHUB_OUTPUT
- name: Build binaries
run: deno task build --bin-path=./bin
- name: Verify build artifacts
run: |
echo "Checking build output files..."
find bin -type f
# Ensure all expected platform-specific files and aliases are present
required_files=(
"gv-x86_64-unknown-linux-gnu"
"gv-aarch64-unknown-linux-gnu"
"gv-x86_64-pc-windows-msvc.exe"
"gv-x86_64-apple-darwin"
"gv-aarch64-apple-darwin"
"gv-linux"
"gv-linux-arm"
"gv-windows.exe"
"gv-macos"
"gv-macos-arm"
)
for file in "${required_files[@]}"; do
if [ ! -f "bin/$file" ]; then
echo "ERROR: Missing binary file: bin/$file"
exit 1
fi
if [ ! -f "bin/$file.zip" ]; then
echo "ERROR: Missing zip file: bin/$file.zip"
exit 1
fi
if [ ! -f "bin/$file.tar.gz" ]; then
echo "ERROR: Missing tar.gz file: bin/$file.tar.gz"
exit 1
fi
done
echo "All required build artifacts have been verified."
- name: Delete existing release if it exists
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
run: |
gh release delete ${{ steps.get_tag.outputs.TAG }} --yes || true
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Upload both zip and tar.gz files
gh release create ${{ steps.get_tag.outputs.TAG }} \
bin/*.zip \
bin/*.tar.gz \
--title "Release ${{ steps.get_tag.outputs.TAG }}" \
--notes-file ${{ steps.get_commit_message.outputs.NOTES_FILE }}