forked from AlphaGPU/leetgpu-challenges
-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (80 loc) · 2.46 KB
/
Copy pathdeploy.yml
File metadata and controls
92 lines (80 loc) · 2.46 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
name: Deploy Challenges to Production
on:
push:
branches:
- main
paths:
- 'challenges/**'
workflow_dispatch: {}
concurrency:
group: pset-update-${{ github.ref }}
cancel-in-progress: true
jobs:
update-pset:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Clone AlphaGPU/leetgpu-pset
shell: bash
env:
PSET_TOKEN: ${{ secrets.PSET_TOKEN }}
run: |
set -euo pipefail
if [[ -z "${PSET_TOKEN:-}" ]]; then
echo "Missing secret PSET_TOKEN with write access to AlphaGPU/leetgpu-pset" >&2
exit 1
fi
git clone --recursive "https://x-access-token:${PSET_TOKEN}@github.com/AlphaGPU/leetgpu-pset.git"
cd leetgpu-pset
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Write .env for pset
working-directory: leetgpu-pset
env:
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
shell: bash
run: |
set -euo pipefail
cat > .env << EOF
SUPABASE_PROJECT_ID=${SUPABASE_PROJECT_ID}
SUPABASE_DB_PASSWORD=${SUPABASE_DB_PASSWORD}
EOF
- name: Run pset update to bump submodule
working-directory: leetgpu-pset
shell: bash
run: |
set -euo pipefail
chmod +x ./scripts/update
./scripts/update
- name: Install Python deps for pset
working-directory: leetgpu-pset
shell: bash
run: |
set -euo pipefail
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run update_challenges for all challenges
working-directory: leetgpu-pset
shell: bash
run: |
set -euo pipefail
python scripts/update_challenge.py
notify:
name: Notify Deployment Status
runs-on: ubuntu-latest
needs: update-pset
if: always()
steps:
- name: Notify Success
if: needs.update-pset.result == 'success'
run: |
echo "Challenge deployment completed successfully!"
- name: Notify Failure
if: needs.update-pset.result == 'failure'
run: |
echo "Challenge deployment failed!"
exit 1