Skip to content

Commit

Permalink
add workflow for preview deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinfuchs committed Aug 11, 2022
1 parent e5657be commit dce715e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Preview Build
on: pull_request

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy Preview
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: "18"
- name: Build
run: npm install && npm run build
- name: Publish
id: publish
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: pages publish build --project-name=discord-resources-wiki --branch=pr-${{ github.run_id }} --commit-dirty=true &> output.txt && [[ $(cat output.txt) =~ https://[0-9a-z]+\.[a-z0-9A-Z-]+\.pages\.dev ]] && echo "::set-output name=stdout::$BASH_REMATCH"

- name: Comment PR
if: always()
uses: thollander/actions-comment-pull-request@v1
with:
message: |
Test Deployment:
${{steps.publish.outputs.stdout}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit dce715e

Please sign in to comment.