forked from nexus-xyz/nexus-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirebase-hosting-pull-request.yml
More file actions
74 lines (66 loc) · 3.14 KB
/
firebase-hosting-pull-request.yml
File metadata and controls
74 lines (66 loc) · 3.14 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
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools
name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all history and tags
- name: Get latest release tag for preview
id: get_version
run: |
# For PR previews, use the latest release tag
echo "Getting latest tag for PR preview..."
if VERSION=$(git describe --tags --abbrev=0 2>/dev/null); then
echo "Found latest tag: ${VERSION}"
else
echo "No tags found, using current Cargo.toml version..."
VERSION="v$(grep '^version = ' clients/cli/Cargo.toml | sed 's/version = "\(.*\)"/\1/')"
echo "Using version from Cargo.toml: ${VERSION}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Final version for preview: ${VERSION}"
- name: Generate install script with release URLs
run: |
VERSION="${{ steps.get_version.outputs.version }}"
BASE_URL="https://github.com/nexus-xyz/nexus-cli/releases/download/${VERSION}"
# Define the download URLs for each platform
LINUX_X86_64_URL="${BASE_URL}/nexus-network-linux-x86_64"
LINUX_ARM64_URL="${BASE_URL}/nexus-network-linux-arm64"
MACOS_X86_64_URL="${BASE_URL}/nexus-network-macos-x86_64"
MACOS_ARM64_URL="${BASE_URL}/nexus-network-macos-arm64"
WINDOWS_X86_64_URL="${BASE_URL}/nexus-network-windows-x86_64.exe"
# Replace placeholders in the template
sed -e "s|__LINUX_X86_64_URL__|${LINUX_X86_64_URL}|g" \
-e "s|__LINUX_ARM64_URL__|${LINUX_ARM64_URL}|g" \
-e "s|__MACOS_X86_64_URL__|${MACOS_X86_64_URL}|g" \
-e "s|__MACOS_ARM64_URL__|${MACOS_ARM64_URL}|g" \
-e "s|__WINDOWS_X86_64_URL__|${WINDOWS_X86_64_URL}|g" \
public/install.sh.template > public/install.sh
# Verify the substitution worked
echo "Generated install.sh for PR preview with URLs for ${VERSION}:"
echo "Linux x86_64: ${LINUX_X86_64_URL}"
echo "Linux ARM64: ${LINUX_ARM64_URL}"
echo "macOS x86_64: ${MACOS_X86_64_URL}"
echo "macOS ARM64: ${MACOS_ARM64_URL}"
echo "Windows x86_64: ${WINDOWS_X86_64_URL}"
# Double-check that no placeholders remain (excluding validation logic)
REMAINING_PLACEHOLDERS=$(grep "__.*_URL__" public/install.sh | grep -v "grep -q" || true)
if [ -n "$REMAINING_PLACEHOLDERS" ]; then
echo "Error: Placeholders still remain in install.sh"
echo "$REMAINING_PLACEHOLDERS"
exit 1
fi
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_NEXUS_CLI }}
projectId: nexus-cli