-
Notifications
You must be signed in to change notification settings - Fork 4
139 lines (124 loc) · 4.72 KB
/
beta-release.yml
File metadata and controls
139 lines (124 loc) · 4.72 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
134
135
136
137
138
139
name: Beta Nightly Build
on:
# Run nightly at midnight UTC
schedule:
- cron: '0 3 * * *'
# Allow manual triggering
workflow_dispatch:
jobs:
check-changes:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Print latest commit
run: echo ${{ github.sha }}
- name: Check if should run
id: should_run
continue-on-error: true
if: ${{ github.event_name == 'schedule' }}
run: |
# Check if there are commits in the last 24 hours
if test -z "$(git rev-list --after='24 hours' ${{ github.sha }})"; then
echo "No commits in the last 24 hours, skipping build"
echo "should_run=false" >> $GITHUB_OUTPUT
else
echo "Recent commits found, proceeding with build"
echo "should_run=true" >> $GITHUB_OUTPUT
fi
generate-version:
runs-on: ubuntu-latest
needs: check-changes
if: ${{ needs.check-changes.outputs.should_run != 'false' }}
outputs:
beta_version: ${{ steps.set-version.outputs.beta_version }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Generate beta version in package.json
run: |
# Get base version from package.json
BASE_VERSION=$(node -p "require('./package.json').version.split('.').slice(0, 2).join('.')")
# Create a timestamp (Unix epoch time in seconds)
TIMESTAMP=$(date +%s)
# Final beta version with timestamp
BETA_VERSION="${BASE_VERSION}.${TIMESTAMP}"
echo "Beta version: $BETA_VERSION"
echo "beta_version=${BETA_VERSION}" >> $GITHUB_OUTPUT
id: set-version
conveyor-beta-build:
name: Build Beta Apps
runs-on: ubuntu-latest
needs: [generate-version, check-changes]
if: ${{ needs.check-changes.outputs.should_run != 'false' }}
permissions:
contents: write
pages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: useblacksmith/setup-node@v5
with:
node-version: '22'
- name: Install Dependencies
run: npm install
- name: Build Repo
run: |
npm run build:beta
- name: Prepare Signing Certificates
run: |
mkdir -p build
echo "${{ secrets.APPLE_CERT }}" | base64 --decode > build/apple.cer
# echo "${{ secrets.WINDOWS_CERT }}" | base64 --decode > build/windows.cer
echo "${{ secrets.APPLE_NOTARIZATION_PRIVATE_KEY }}" > AuthKey_W442ZA3W3A.p8
- name: Setup build environment
run: |
npm run make:beta
env:
APTABASE_APP_KEY: ${{ secrets.VITE_APTABASE_APP_KEY }}
- name: Update package.json with beta version
run: |
# Update package.json with the beta version using npm pkg
npm pkg set version="${{ needs.generate-version.outputs.beta_version }}-beta"
- name: Run Conveyor for Beta Build
uses: hydraulic-software/conveyor/actions/build@v18.1
env:
APPLE_ASP: ${{ secrets.APPLE_ASP }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SITE_RELEASE_TOKEN: ${{ secrets.SITE_RELEASE_TOKEN }}
NODE_ENV: production
ENV: production
MODE: beta
BUILD_VERSION: ${{ needs.generate-version.outputs.beta_version }}
APTABASE_APP_KEY: ${{ secrets.VITE_APTABASE_APP_KEY }}
APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
APPLE_NOTARIZATION_PRIVATE_KEY: ${{ secrets.APPLE_NOTARIZATION_PRIVATE_KEY }}
APPLE_NOTARIZATION_PRIVATE_KEY_PATH: AuthKey_W442ZA3W3A.p8
MAC_CERTIFICATE_PATH: build/apple.cer
# WINDOWS_CERTIFICATE_PATH: build/windows.cer
with:
command: make copied-site
signing_key: ${{ secrets.SIGNING_KEY }}
extra_flags: -f conveyor.beta.conf
agree_to_license: 1
- name: Restore Original Node Modules
run: |
echo "🔄 Restoring original node_modules..."
if [ -d "node_modules.bk" ]; then
# Remove any node_modules directory that might have been created
if [ -d "node_modules" ]; then
rm -rf node_modules
fi
mv node_modules.bk node_modules
echo "✅ Node modules restored successfully"
else
echo "⚠️ Warning: node_modules.bk not found for restoration"
fi