generated from int128/typescript-actions-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 7
92 lines (83 loc) · 3.06 KB
/
bootstrap-pull-request.yaml
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
name: bootstrap-pull-request
on:
pull_request:
paths:
- bootstrap-pull-request/**
- '*.json'
- .github/workflows/bootstrap-pull-request.yaml
push:
branches:
- main
paths:
- bootstrap-pull-request/**
- '*.json'
- .github/workflows/bootstrap-pull-request.yaml
defaults:
run:
working-directory: bootstrap-pull-request
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 20
cache: yarn
- run: yarn
- run: yarn test
e2e-test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 20
cache: yarn
- run: yarn
- run: yarn build
- run: yarn package
- run: |
git config --global user.email '[email protected]'
git config --global user.name 'github-actions'
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.head_ref }} # avoid "shallow update not allowed" error
path: prebuilt-branch
- name: Set up an prebuilt branch
working-directory: prebuilt-branch
run: |
mkdir -vp services/a
mkdir -vp services/b
touch services/a/generated.yaml
touch services/b/generated.yaml
git add .
git commit -m "Add prebuilt branch for e2e-test of ${GITHUB_REF}"
git push origin "HEAD:refs/heads/prebuilt/monorepo-deploy-actions/overlay-${{ github.run_id }}"
- uses: ./bootstrap-pull-request
with:
overlay: overlay-${{ github.run_id }}
namespace: pr-${{ github.event.number }}
destination-repository: ${{ github.repository }}
namespace-manifest: bootstrap-pull-request/tests/fixtures/namespace.yaml
substitute-variables: NAMESPACE=pr-${{ github.event.number }}
# the action should be idempotent
- uses: ./bootstrap-pull-request
with:
overlay: overlay-${{ github.run_id }}
namespace: pr-${{ github.event.number }}
destination-repository: ${{ github.repository }}
namespace-manifest: bootstrap-pull-request/tests/fixtures/namespace.yaml
substitute-variables: NAMESPACE=pr-${{ github.event.number }}
- name: Clean up the namespace branch
continue-on-error: true
if: always()
run: |
git push origin --delete "refs/heads/ns/monorepo-deploy-actions/overlay-${{ github.run_id }}/pr-${{ github.event.number }}"
- name: Clean up the prebuilt branch
continue-on-error: true
if: always()
run: |
git push origin --delete "refs/heads/prebuilt/monorepo-deploy-actions/overlay-${{ github.run_id }}"