Merge pull request #12 from OpenSyntaxHQ/dependabot/github_actions/de… #32
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 Staging | |
| on: | |
| push: | |
| branches: [develop] | |
| env: | |
| NODE_VERSION: '20' | |
| jobs: | |
| deploy-staging: | |
| name: Deploy to Staging | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: staging | |
| url: ${{ steps.deploy.outputs.deploy-url }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build docs site | |
| run: npm run docs:build | |
| - name: Verify Netlify credentials | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| run: | | |
| code=$(curl -s -o /dev/null -w "%{http_code}" \ | |
| -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \ | |
| "https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID") | |
| echo "Netlify API status: $code" | |
| test "$code" = "200" | |
| - name: Deploy to Netlify (Staging) | |
| id: deploy | |
| uses: nwtgck/actions-netlify@v3.0 | |
| with: | |
| publish-dir: './docs-dist' | |
| production-deploy: false | |
| deploy-message: "Staging deployment from develop" | |
| alias: staging | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| - name: Run smoke tests | |
| run: | | |
| sleep 10 | |
| curl -f "${{ steps.deploy.outputs.deploy-url }}" || exit 1 |