@@ -20,132 +20,151 @@ permissions:
20
20
contents : read # This is required for actions/checkout
21
21
22
22
jobs :
23
- e2e :
23
+ check_next_version :
24
24
runs-on : ubuntu-latest
25
+
25
26
steps :
27
+ - name : Checkout code
28
+ uses : actions/checkout@v3
26
29
27
- - name : Get Latest Release
28
- id : get_release
30
+ - name : Get Latest Next Version
31
+ id : get_latest_version
29
32
run : |
30
- latest_release=$(curl -s https://api.github.com/repos/vercel/next.js/releases/latest | jq -r '.tag_name')
31
- echo "Latest release: $latest_release"
32
- echo "LATEST_RELEASE=$latest_release" >> $GITHUB_ENV
33
-
34
- - name : Download Previous Release Artifact
35
- uses : actions/download-artifact@v3
36
- continue-on-error : true
33
+ latest_version=$(curl -s https://api.github.com/repos/vercel/next.js/releases/latest | jq -r '.tag_name')
34
+ echo "Latest version: $latest_version"
35
+ echo "LATEST_VERSION=$latest_version" >> $GITHUB_ENV
36
+ echo "LATEST_VERSION=$latest_version" >> $GITHUB_OUTPUT
37
+
38
+ - name : Restore Cache Previous Version
39
+ id : cache-previous
40
+ uses : actions/cache/restore@v3
37
41
with :
38
- name : previous-release
42
+ path : previous_version.txt
43
+ key : ${{ runner.os }}-previous
39
44
40
- - name : Compare Releases
41
- id : compare_releases
45
+ - name : Compare Versions
46
+ id : compare_versions
42
47
run : |
43
- latest_release=$LATEST_RELEASE
44
- if [ -f previous_release.txt ]; then
45
- previous_release=$(cat previous_release.txt)
48
+ latest_version=$LATEST_VERSION
49
+ if [ -f previous_version.txt ]; then
50
+ previous_version=$(cat previous_version.txt)
51
+ echo "pv: $previous_version"
46
52
else
47
- previous_release =""
53
+ previous_version =""
48
54
fi
49
-
50
- echo "$previous_release"
51
-
52
- if [ "$latest_release" != "$previous_release" ]; then
53
- echo "Releases are different. Continuing the pipeline."
55
+
56
+ if [ "$latest_version" != "$previous_version" ]; then
57
+ echo "Versions are different. Continuing the pipeline."
54
58
else
55
- echo "Releases are the same. Exiting with success."
56
- exit 0
59
+ echo "Versions are the same. Exiting with success."
60
+ echo "SKIP=true" >> $GITHUB_OUTPUT
57
61
fi
58
62
59
- - name : Store Latest Release
60
- run : echo "$LATEST_RELEASE" > previous_release.txt
63
+ outputs :
64
+ skip : ${{ steps.compare_versions.outputs.SKIP }}
65
+ previousNextVersion : ${{ steps.get_latest_version.outputs.LATEST_VERSION }}
66
+ cacheKey : ${{ steps.cache-previous.outputs.cache-primary-key }}
61
67
62
- - name : Upload Previous Release Artifact
63
- uses : actions/upload-artifact@v3
64
- with :
65
- name : previous-release
66
- path : previous_release.txt
68
+ e2e :
69
+ needs : check_next_version
70
+ if : needs.check_next_version.outputs.skip != 'true'
71
+ runs-on : ubuntu-latest
72
+ steps :
67
73
68
74
- name : Checkout code
69
75
uses : actions/checkout@v3
70
76
71
- - name : Configure AWS credentials
72
- uses : aws-actions/configure-aws-credentials@v2
73
- with :
74
- aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
75
- aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
76
- aws-region : us-east-1
77
-
78
- - name : Setup pnpm
79
- uses : pnpm/action-setup@v2
80
- with :
81
- version : 8
82
-
83
- - name : Set up NodeJS v18
84
- uses : actions/setup-node@v3
85
- with :
86
- cache : pnpm # cache pnpm store
87
- node-version : 18.16.1
88
-
89
- - name : Install packages
90
- run : pnpm install
91
-
92
- - name : Get Playwright version
93
- id : playwright-version
94
- run : echo "version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | sed 's/ .*//' )"
95
-
96
- - name : Cache Playwright
97
- uses : actions/cache@v3
98
- id : playwright-cache
99
- with :
100
- path : " ~/.cache/ms-playwright"
101
- key : ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}
102
- restore-keys : |
103
- ${{ runner.os }}-playwright-
104
-
105
- - name : Install Playwright
106
- if : steps.playwright-cache.outputs.cache-hit != 'true'
107
- run : pnpm exec playwright install chromium --with-deps
108
-
109
- # Cache turbo runs
110
- - name : Cache Turbo
111
- uses : actions/cache@v3
112
- with :
113
- path : .turbo
114
- key : ${{ runner.os }}-turbo-${{ github.sha }}
115
- restore-keys : |
116
- ${{ runner.os }}-turbo-
117
-
118
- # Build all the packages
119
- - name : Build
120
- run : pnpm run build
121
-
122
- # Deploy e2e stage
123
- - name : Deploy NextjsSite
124
- working-directory : examples/sst
125
- run : npx sst deploy --stage e2e
126
-
127
- # Load app urls from .sst/output.json file
128
- - name : Set environments
129
- working-directory : examples/sst
77
+ # - name: Configure AWS credentials
78
+ # uses: aws-actions/configure-aws-credentials@v2
79
+ # with:
80
+ # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
81
+ # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
82
+ # aws-region: us-east-1
83
+
84
+ # - name: Setup pnpm
85
+ # uses: pnpm/action-setup@v2
86
+ # with:
87
+ # version: 8
88
+
89
+ # - name: Set up NodeJS v18
90
+ # uses: actions/setup-node@v3
91
+ # with:
92
+ # cache: pnpm # cache pnpm store
93
+ # node-version: 18.16.1
94
+
95
+ # - name: Install packages
96
+ # run: pnpm install
97
+
98
+ # - name: Get Playwright version
99
+ # id: playwright-version
100
+ # run: echo "version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | sed 's/ .*//' )"
101
+
102
+ # - name: Cache Playwright
103
+ # uses: actions/cache@v3
104
+ # id: playwright-cache
105
+ # with:
106
+ # path: "~/.cache/ms-playwright"
107
+ # key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}
108
+ # restore-keys: |
109
+ # ${{ runner.os }}-playwright-
110
+
111
+ # - name: Install Playwright
112
+ # if: steps.playwright-cache.outputs.cache-hit != 'true'
113
+ # run: pnpm exec playwright install chromium --with-deps
114
+
115
+ # # Cache turbo runs
116
+ # - name: Cache Turbo
117
+ # uses: actions/cache@v3
118
+ # with:
119
+ # path: .turbo
120
+ # key: ${{ runner.os }}-turbo-${{ github.sha }}
121
+ # restore-keys: |
122
+ # ${{ runner.os }}-turbo-
123
+
124
+ # # Build all the packages
125
+ # - name: Build
126
+ # run: pnpm run build
127
+
128
+ # # Deploy e2e stage
129
+ # - name: Deploy NextjsSite
130
+ # working-directory: examples/sst
131
+ # run: npx sst deploy --stage e2e
132
+
133
+ # # Load app urls from .sst/output.json file
134
+ # - name: Set environments
135
+ # working-directory: examples/sst
136
+ # run: |
137
+ # APP_ROUTER_URL=$(jq -r '.["e2e-example-AppRouter"].url' .sst/outputs.json)
138
+ # echo "APP_ROUTER_URL=$APP_ROUTER_URL" >> $GITHUB_ENV
139
+ # PAGES_ROUTER_URL=$(jq -r '.["e2e-example-PagesRouter"].url' .sst/outputs.json)
140
+ # echo "PAGES_ROUTER_URL=$PAGES_ROUTER_URL" >> $GITHUB_ENV
141
+ # APP_PAGES_ROUTER_URL=$(jq -r '.["e2e-example-AppPagesRouter"].url' .sst/outputs.json)
142
+ # echo "APP_PAGES_ROUTER_URL=$APP_PAGES_ROUTER_URL" >> $GITHUB_ENV
143
+
144
+ # - name: Run e2e Test
145
+ # run: npm run e2e:test
146
+
147
+ # - name: Archive
148
+ # if: failure()
149
+ # uses: actions/upload-artifact@v3
150
+ # with:
151
+ # name: sst
152
+ # path: |
153
+ # .sst/
154
+ # .next/
155
+
156
+ - name : debug
130
157
run : |
131
- APP_ROUTER_URL=$(jq -r '.["e2e-example-AppRouter"].url' .sst/outputs.json)
132
- echo "APP_ROUTER_URL=$APP_ROUTER_URL" >> $GITHUB_ENV
133
- PAGES_ROUTER_URL=$(jq -r '.["e2e-example-PagesRouter"].url' .sst/outputs.json)
134
- echo "PAGES_ROUTER_URL=$PAGES_ROUTER_URL" >> $GITHUB_ENV
135
- APP_PAGES_ROUTER_URL=$(jq -r '.["e2e-example-AppPagesRouter"].url' .sst/outputs.json)
136
- echo "APP_PAGES_ROUTER_URL=$APP_PAGES_ROUTER_URL" >> $GITHUB_ENV
137
-
138
- - name : Run e2e Test
139
- run : npm run e2e:test
140
-
158
+ echo "cache key: ${{ needs.check_next_version.outputs.cacheKey }}"
159
+ echo "version: ${{ needs.check_next_version.outputs.previousNextVersion }}"
141
160
142
-
143
-
144
- - name : Archive
145
- if : failure()
146
- uses : actions/upload-artifact@v3
161
+ - name : Store Latest Version
162
+ run : |
163
+ echo "version: ${{ needs.check_next_version.outputs.previousNextVersion }}"
164
+ echo "${{ needs.check_next_version.outputs.previousNextVersion }}" > previous_version.txt
165
+
166
+ - name : Cache Previous Version
167
+ uses : actions/cache/save@v3
147
168
with :
148
- name : sst
149
- path : |
150
- .sst/
151
- .next/
169
+ path : previous_version.txt
170
+ key : ${{ needs.check_next_version.outputs.cacheKey }}
0 commit comments