9797 - name : Upload release archive
9898 env :
9999 GH_TOKEN : ${{ github.token }}
100- run : gh release upload ${VERSION} ${{ steps.archive.outputs.ARCHIVE_NAME }}
100+ run : gh release upload ${VERSION} ${{ steps.archive.outputs.ARCHIVE_NAME }}
101+
102+ update-install-script :
103+ name : Update install script on GitHub Pages
104+ runs-on : ubuntu-latest
105+ needs : build
106+ environment : github_release
107+ steps :
108+ - name : Checkout celq repository (for template)
109+ uses : actions/checkout@v4
110+ with :
111+ path : celq-repo
112+
113+ - name : Checkout get-celq.github.io repository
114+ uses : actions/checkout@v4
115+ with :
116+ repository : get-celq/get-celq.github.io
117+ token : ${{ secrets.PAGES_DEPLOY_TOKEN }}
118+ path : pages-repo
119+
120+ - name : Generate install scripts
121+ run : |
122+ VERSION="${{ github.ref_name }}"
123+
124+ # Generate versioned install script (e.g., v0.1.1/install.sh or v0.2.0-beta.1/install.sh)
125+ mkdir -p "pages-repo/${VERSION}"
126+ sed "s/{{CELQ_VERSION}}/${VERSION}/g" celq-repo/template_install.sh > "pages-repo/${VERSION}/install.sh"
127+ chmod +x "pages-repo/${VERSION}/install.sh"
128+
129+ # Only update root install.sh if this is NOT a pre-release
130+ # Pre-releases have a hyphen (e.g., v0.2.0-beta.1, v1.0.0-rc.1)
131+ if [[ ! "$VERSION" =~ -[a-zA-Z] ]]; then
132+ echo "Stable release detected, updating root install.sh"
133+ sed "s/{{CELQ_VERSION}}/${VERSION}/g" celq-repo/template_install.sh > pages-repo/install.sh
134+ chmod +x pages-repo/install.sh
135+ else
136+ echo "Pre-release detected, skipping root install.sh update"
137+ fi
138+
139+ # Copy generated script for GitHub release attachment
140+ cp "pages-repo/${VERSION}/install.sh" celq-repo/install.sh
141+
142+ - name : Upload install.sh to GitHub release
143+ env :
144+ GH_TOKEN : ${{ github.token }}
145+ run : |
146+ cd celq-repo
147+ gh release upload ${{ github.ref_name }} install.sh --clobber
148+
149+ - name : Commit and push changes to Pages repo
150+ run : |
151+ cd pages-repo
152+ git config user.name "github-actions[bot]"
153+ git config user.email "github-actions[bot]@users.noreply.github.com"
154+
155+ VERSION="${{ github.ref_name }}"
156+
157+ # Add versioned install script
158+ git add "${VERSION}/install.sh"
159+
160+ # Only add root install.sh if it was updated (stable release)
161+ if [[ ! "$VERSION" =~ -[a-zA-Z] ]]; then
162+ git add install.sh
163+ git commit -m "Update install script to $VERSION (stable release)" || echo "No changes to commit"
164+ else
165+ git commit -m "Add install script for $VERSION (pre-release)" || echo "No changes to commit"
166+ fi
167+
168+ git push
0 commit comments