forked from remix-run/remix
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (105 loc) · 4.53 KB
/
nightly.yml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: 🌒 Nightly Release
on:
workflow_dispatch:
schedule:
- cron: "0 7 * * *" # every day at 12AM PST
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CI: true
jobs:
# HEADS UP! this "nightly" job will only ever run on the `main` branch due to it being a cron job,
# and the last commit on main will be what github shows as the trigger
# however in the checkout below we specify the `dev` branch, so all the scripts
# in this job will be ran from that, confusing i know, so in some cases we'll need to create
# multiple PRs when modifying nightly release processes
nightly:
name: 🌒 Nightly Release
if: github.repository == 'remix-run/remix'
runs-on: ubuntu-latest
outputs:
# allows this to be used in the `comment` job below - will be undefined if there's no release necessary
NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
ref: dev
# checkout using a custom token so that we can push later on
token: ${{ secrets.NIGHTLY_PAT }}
fetch-depth: 0
- name: 📦 Setup pnpm
uses: pnpm/action-setup@v3.0.0
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: 📥 Install deps
run: pnpm install --frozen-lockfile
- name: 🕵️ Check for changes
id: version
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
# get latest nightly tag
LATEST_NIGHTLY_TAG=$(git tag -l v0.0.0-nightly-\* --sort=-creatordate | head -n 1)
# check if last commit to dev starts would be the nightly tag we're about to create (minus the date)
# if it is, we'll skip the nightly creation
# if not, we'll create a new nightly tag
if [[ ${LATEST_NIGHTLY_TAG} == v0.0.0-nightly-${SHORT_SHA}-* ]]; then
echo "🛑 Latest nightly tag is the same as the latest commit sha, skipping nightly release"
else
# yyyyMMdd format (e.g. 20221207)
DATE=$(date '+%Y%m%d')
# v0.0.0-nightly-<short sha>-<date>
NEXT_VERSION=0.0.0-nightly-${SHORT_SHA}-${DATE}
# set output so it can be used in other jobs
echo "NEXT_VERSION=${NEXT_VERSION}" >> $GITHUB_OUTPUT
fi
- name: ⤴️ Update version
if: steps.version.outputs.NEXT_VERSION
run: |
git config --local user.email "hello@remix.run"
git config --local user.name "Remix Run Bot"
git checkout -b nightly/${{ steps.version.outputs.NEXT_VERSION }}
pnpm run version ${{steps.version.outputs.NEXT_VERSION}} --skip-prompt
git push origin --tags
- name: 🏗 Build
if: steps.version.outputs.NEXT_VERSION
run: pnpm build
- name: 🔐 Setup npm auth
if: steps.version.outputs.NEXT_VERSION
run: |
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: 🚀 Publish
if: steps.version.outputs.NEXT_VERSION
run: npm run publish
comment:
needs: [nightly]
name: 📝 Comment on related issues and pull requests
if: github.repository == 'remix-run/remix' && needs.nightly.outputs.NEXT_VERSION
uses: ./.github/workflows/release-comments.yml
deployments:
needs: [nightly]
name: 🚀 Deployment Tests
if: github.repository == 'remix-run/remix' && needs.nightly.outputs.NEXT_VERSION
uses: remix-run/remix/.github/workflows/deployments.yml@main
secrets:
TEST_AWS_ACCESS_KEY_ID: ${{ secrets.TEST_AWS_ACCESS_KEY_ID }}
TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_AWS_SECRET_ACCESS_KEY }}
TEST_CF_ACCOUNT_ID: ${{ secrets.TEST_CF_ACCOUNT_ID }}
TEST_CF_GLOBAL_API_KEY: ${{ secrets.TEST_CF_GLOBAL_API_KEY }}
TEST_CF_EMAIL: ${{ secrets.TEST_CF_EMAIL }}
TEST_CF_PAGES_API_TOKEN: ${{ secrets.TEST_CF_PAGES_API_TOKEN }}
TEST_CF_API_TOKEN: ${{ secrets.TEST_CF_API_TOKEN }}
TEST_DENO_DEPLOY_TOKEN: ${{ secrets.TEST_DENO_DEPLOY_TOKEN }}
TEST_FLY_TOKEN: ${{ secrets.TEST_FLY_TOKEN }}
stacks:
needs: [nightly]
name: 🥞 Remix Stacks Test
if: github.repository == 'remix-run/remix' && needs.nightly.outputs.NEXT_VERSION
uses: remix-run/remix/.github/workflows/stacks.yml@main
with:
version: "${{ needs.nightly.outputs.NEXT_VERSION }}"