Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc9f440

Browse files
committed
use GH deployment environment for pull request previews
1 parent 05152be commit bc9f440

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/preview.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,21 @@ on: [pull_request]
55
permissions:
66
pull-requests: write # allow surge-preview to create/update PR comments
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
env:
13+
PREVIEW_URL: 'https://github.com/{{ github.repository }}-{{ github.job }}-pr-{{ github.event.number }}.surge.sh'
14+
PRODUCTION_URL: 'https://tutorial.xarray.dev/'
15+
816
jobs:
917
preview:
1018
runs-on: ubuntu-latest
19+
environment:
20+
name: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }}
21+
url: ${{ github.ref == 'refs/heads/main' && env.PRODUCTION_URL || env.PREVIEW_URL }}
22+
1123
steps:
1224
- name: Checkout repository
1325
uses: actions/checkout@v3

0 commit comments

Comments
 (0)