-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
78 lines (67 loc) · 2.58 KB
/
preview.yml
File metadata and controls
78 lines (67 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Create "installable" preview branches
#
# Commits to `dev` push builds to a `preview/dev` branch:
# pnpm install "remix-run/react-router#preview/dev&path:packages/react-router"
#
# Can also be dispatched manually with base/installable branches to provide
# `experimental` branches from PRs or otherwise.
name: Preview Build
on:
push:
branches:
- dev
workflow_dispatch:
inputs:
baseBranch:
description: Base Branch
required: true
installableBranch:
description: Installable Branch
required: true
concurrency:
# Include `event_name` here because when a pull_request is merged (closed), the
# `github.ref` goes back to `ref/heads/dev` which will conflict with the run on
# `dev` from the merged PR
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
preview:
if: github.repository == 'remix-run/react-router'
runs-on: ubuntu-latest
steps:
- name: Checkout (push)
if: github.event_name == 'push'
uses: actions/checkout@v4
- name: Checkout (workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ inputs.baseBranch }}
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup git
run: |
git config --local user.email "hello@remix.run"
git config --local user.name "Remix Run Bot"
# Build and force push over the preview/dev branch
- name: Build/push branch (push)
if: github.event_name == 'push'
run: |
pnpm run setup-installable-branch preview/dev
git push --force --set-upstream origin preview/dev
echo "💿 pushed installable branch: https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)"
# Build and normal push for experimental releases to avoid unintended force
# pushes over remote branches in case of a branch name collision
- name: Build/push branch (workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
pnpm run setup-installable-branch ${{ inputs.installableBranch }}
git push --set-upstream origin ${{ inputs.installableBranch }}
echo "💿 pushed installable branch: https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)"