-
-
Notifications
You must be signed in to change notification settings - Fork 44
125 lines (124 loc) · 4.31 KB
/
ci.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
123
124
125
name: Test branch
on:
- push
- pull_request
jobs:
deploy-ssh-no-branch:
name: Test deploying to a new branch
runs-on: ubuntu-latest
# do not run from forks, as forks don’t have access to repository secrets
if: github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
steps:
- uses: actions/checkout@master
- name: Setup Dummy Data
run: |
mkdir dummy
echo "foobar" > "dummy/baz"
echo "foobar" > "dummy/.bat"
- name: Setup SSH Keys and known_hosts
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
SSH_PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
cp action/resources/known_hosts_github.com ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${SSH_PRIVATE_KEY}"
- name: Delete existing banch
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: git push git@github.com:s0/git-publish-subdir-action-tests.git +:refs/heads/branch-a
- name: Deploy
uses: ./
env:
REPO: git@github.com:s0/git-publish-subdir-action-tests.git
BRANCH: branch-a
FOLDER: dummy
SSH_PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }}
deploy-ssh-existing-branch:
name: Test deploying to a pre-existing branch
runs-on: ubuntu-latest
# do not run from forks, as forks don’t have access to repository secrets
if: github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
steps:
- uses: actions/checkout@master
- name: Setup Dummy Data
run: |
mkdir dummy
echo "foobar" > "dummy/baz"
echo "foobar" > "dummy/.bat"
- name: Deploy
uses: ./
env:
REPO: git@github.com:s0/git-publish-subdir-action-tests.git
BRANCH: branch-b
FOLDER: dummy
SSH_PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }}
deploy-ssh-existing-branch-known_hosts:
name: Test deploying to a pre-existing branch (with KNOWN_HOSTS_FILE)
runs-on: ubuntu-latest
# do not run from forks, as forks don’t have access to repository secrets
if: github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
steps:
- uses: actions/checkout@master
- name: Setup Dummy Data
run: |
mkdir dummy
echo "foobar" > "dummy/baz"
echo "foobar" > "dummy/.bat"
- name: Deploy
uses: ./
env:
REPO: git@github.com:s0/git-publish-subdir-action-tests.git
BRANCH: branch-c
FOLDER: dummy
SSH_PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }}
KNOWN_HOSTS_FILE: action/resources/known_hosts_github.com
deploy-ssh-twice:
name: Test deploying multiple times in one job
runs-on: ubuntu-latest
# do not run from forks, as forks don’t have access to repository secrets
if: github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
steps:
- uses: actions/checkout@master
- name: Setup Dummy Data
run: |
mkdir dummy1
echo "foobar1" > "dummy1/baz"
echo "foobar1" > "dummy1/.bat"
mkdir dummy2
echo "foobar2" > "dummy2/baz"
echo "foobar2" > "dummy2/.bat"
- name: Deploy
uses: ./
env:
REPO: git@github.com:s0/git-publish-subdir-action-tests.git
BRANCH: branch-d
FOLDER: dummy1
SSH_PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }}
- name: Deploy
uses: ./
env:
REPO: git@github.com:s0/git-publish-subdir-action-tests.git
BRANCH: branch-d
FOLDER: dummy2
SSH_PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }}
deploy-locally:
name: Test deploying to another branch of same repo
runs-on: ubuntu-latest
# do not run from forks, as forks don’t have access to repository secrets
if: github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
steps:
- uses: actions/checkout@master
- name: Setup Dummy Data
run: |
mkdir dummy
echo "foobar" > "dummy/baz"
echo "foobar" > "dummy/.bat"
- name: Deploy
uses: ./
env:
REPO: self
BRANCH: test-branch
FOLDER: dummy
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}