remove intermediary step for secret config #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Debug environment | |
| run: | | |
| echo "Current directory contents:" | |
| ls -la | |
| echo "Checking if webhook URL is set:" | |
| if [ -n "${{ secrets.DISCORD_WEBHOOK_URL }}" ]; then | |
| echo "Webhook URL is set" | |
| else | |
| echo "Webhook URL is NOT set" | |
| exit 1 | |
| fi | |
| - name: Inject webhook URL | |
| env: | |
| WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| run: | | |
| echo "Injecting webhook URL into index.html..." | |
| # Create a temporary file with the replacement | |
| sed "s|const getConfigPath = .*|const webhookUrl = '$WEBHOOK_URL'; // Injected during build|" index.html > index.html.tmp | |
| # Replace the original file | |
| mv index.html.tmp index.html | |
| echo "Webhook URL injected successfully" | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: '.' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |