-
-
Notifications
You must be signed in to change notification settings - Fork 9
130 lines (109 loc) · 3.81 KB
/
build-release.yml
File metadata and controls
130 lines (109 loc) · 3.81 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
name: Build Application (Release)
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
environment: BUILD_PRODUCTION
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-26, macos-26-intel]
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event_name == 'push' && 'main' || github.ref_name }}
- uses: actions/setup-node@v5
with:
node-version: 22
- name: Create .env
shell: bash
env:
ENV_FILE: ${{ secrets.ENV_FILE }}
run: |
if [ -n "$ENV_FILE" ]; then
printf '%s' "$ENV_FILE" > .env
fi
- name: Install deps
run: yarn install --frozen-lockfile
- name: Build (package)
run: yarn build:package --nativeModules ${{ matrix.os == 'macos-15-intel' && '--mac-x64' || '' }}
env:
BUILD_VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
PUBLISH_BRANCH_FROM_TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
- name: Show release contents (debug)
shell: bash
run: |
if [ -d release ]; then
echo "release/ files:"
find release -maxdepth 2 -type f | sort
else
echo "release/ not found"; exit 1
fi
- name: Upload release/ to S3
shell: bash
run: |
BRANCH="${{ github.ref_name }}"
PREFIX="builds/releases"
npx -y tsx scripts/s3-upload.ts \
--branch "$BRANCH" \
--dir "release" \
--prefix "$PREFIX" \
--mac-manifest
- name: Upload release artifacts for GitHub Release
uses: actions/upload-artifact@v7
with:
name: release-${{ matrix.os }}
path: release/**/*
if-no-files-found: error
- name: Publish changelog (single-run on ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' && !contains(github.ref_name, 'dev') }}
shell: bash
run: |
VERSION_ARGS=()
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
VERSION_ARGS=(--version "${{ github.ref_name }}")
fi
yarn publish:api "${VERSION_ARGS[@]}"
yarn publish:discord "${VERSION_ARGS[@]}"
github_release:
name: Create GitHub Release
needs: build
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
pattern: release-*
path: github-release-artifacts
- name: Prepare GitHub Release assets
shell: bash
run: |
mkdir -p github-release-assets
declare -A NAME_COUNT=()
while IFS= read -r -d '' file; do
base_name="$(basename "$file")"
artifact_dir="$(printf '%s' "$file" | sed -E 's#^github-release-artifacts/([^/]+)/.*#\1#')"
target_name="$base_name"
name_count="${NAME_COUNT[$base_name]:-0}"
if (( name_count > 0 )); then
target_name="${artifact_dir}-${name_count}-${base_name}"
fi
NAME_COUNT["$base_name"]=$((name_count + 1))
cp "$file" "github-release-assets/$target_name"
done < <(find github-release-artifacts -type f -print0 | sort -z)
find github-release-assets -maxdepth 1 -type f | sort
- name: Create GitHub Release
uses: softprops/action-gh-release@v2.5.0
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
generate_release_notes: true
overwrite_files: true
fail_on_unmatched_files: true
files: |
github-release-assets/*