forked from intershop/intershop-pwa
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 1.7 KB
/
automated-upgrade.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
name: AutomatedUpgrade
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
paths:
- scripts/upgrade-pwa.js
schedule:
- cron: '0 0 * * 1'
env:
NODE_VERSION: 16.16.0
jobs:
CancelPrevious:
runs-on: ubuntu-latest
steps:
- name: Cancel Old Pipeline
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AutomatedUpgrade:
needs: [CancelPrevious]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
if: github.ref != 'refs/heads/develop'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v2
if: github.ref == 'refs/heads/develop'
with:
ref: develop
- name: Use Node.js 16
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Create Upgrade Branch
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub CI"
git switch -c upgrade/automated-upgrade
- name: Run Upgrade Script
run: node scripts/upgrade-pwa
- name: Run Automated Fixes
run: |
npm run lint -- --fix
npm run format
git add .
git commit -m "chore: post upgrade fixes" --allow-empty
- name: Run Tests
run: npm run test
- name: Push Upgrade Branch
if: always()
run: git push --force origin upgrade/automated-upgrade