ci: publish to Cloudflare Pages
This commit is contained in:
parent
dfa46e0a92
commit
8fa5df3425
1 changed files with 6 additions and 75 deletions
81
.github/workflows/deploy.yml
vendored
81
.github/workflows/deploy.yml
vendored
|
@ -2,84 +2,15 @@ on:
|
|||
push:
|
||||
branches:
|
||||
master
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
NODE_VERSION: 16
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
name: Prepare
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: site
|
||||
path: |
|
||||
index.html
|
||||
styles.css
|
||||
me.png
|
||||
preview:
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare
|
||||
name: Deploy preview
|
||||
if: ${{ github.ref != 'refs/heads/master' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
id: node-setup
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- name: Netlify CLI setup
|
||||
run: npm install -g netlify-cli
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: site
|
||||
path: dist
|
||||
- name: Deploy
|
||||
id: preview-deploy
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
run: |
|
||||
netlify deploy --dir=dist > output.log
|
||||
echo "::set-output name=draft-url::$(grep 'Website Draft URL' output.log)"
|
||||
- name: Report
|
||||
uses: actions/github-script@v2
|
||||
env:
|
||||
DRAFT_URL: ${{ steps.preview-deploy.outputs.draft-url }}
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `:eyes: Branch deployed at ${process.env.DRAFT_URL}`
|
||||
})
|
||||
deploy:
|
||||
name: Deploy site
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploy
|
||||
needs: prepare
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
id: node-setup
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- name: Build Artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: site
|
||||
path: dist
|
||||
- name: Netlify CLI setup
|
||||
run: npm install -g netlify-cli
|
||||
- name: Deploy
|
||||
id: preview-deploy
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
run: |
|
||||
netlify deploy --dir=dist --prod
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy --project-name=profile-page .
|
||||
|
|
Loading…
Reference in a new issue