Repository navigation
138 lines (116 loc) · 4.75 KB
/
Copy pathdeploy.yml
File metadata and controls
138 lines (116 loc) · 4.75 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
# This workflow will perform the following steps for pushes the the develop branch
# * build the Schema and the Guidelines with Ant
# * publish the Schema to music-encoding/schema under ./dev
# * publish the Guidelines to music-encoding/guidelines under ./dev
name: Deploy Schema and Guidelines
on:
push:
branches: [ develop ]
env:
# schema
SCHEMA_REPO: ${{ github.repository_owner }}/schema
SCHEMA_BRANCH: main
# guidelines
GUIDELINES_REPO: ${{ github.repository_owner }}/guidelines
GUIDELINES_BRANCH: main
# temporary directories
SCHEMA_DIR: schema-dir
GUIDELINES_DIR: guidelines-dir
jobs:
build:
runs-on: ubuntu-latest
steps:
### BUIDLING THE SCHEMA AND THE GUIDELINES ###
- name: Checkout main repo
uses: actions/checkout@v2
with:
# Whether to checkout submodules: `true` to checkout submodules or `recursive` to
# recursively checkout submodules.
#
# When the `ssh-key` input is not provided, SSH URLs beginning with
# `git@github.com:` are converted to HTTPS.
#
# Default: false
submodules: recursive
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Ant
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant
run: |
ant -noinput -buildfile build.xml init
ant -noinput -buildfile build.xml -lib lib/saxon/saxon-he-10.5.jar -Dgithub.sha=${{ github.sha }}
### PUBLISHING THE SCHEMA ###
- name: Checkout SCHEMA_REPO into SCHEMA_DIR
uses: actions/checkout@v2
with:
# repository to check out
repository: ${{ env.SCHEMA_REPO }}
# Deploy key as secret for accessing <owner>/<SCHEMA_REPO>;
# cf. explanation in https://github.com/rism-ch/verovio/pull/1751
ssh-key: ${{ secrets.GH_ACTIONS_DEPLOY_KEY_SCHEMA }}
# ref (branch, tag or SHA) to check out
ref: ${{ env.SCHEMA_BRANCH }}
# relative path under $GITHUB_WORKSPACE to place the repository
path: ${{ env.SCHEMA_DIR }}
- name: Copy built schema to SCHEMA_DIR
run: cp -r dist/schemata/dev $SCHEMA_DIR/
- name: Check git status before commit
working-directory: ${{ env.SCHEMA_DIR }}
run: |
git config --get remote.origin.url
git status
- name: Configure git
working-directory: ${{ env.SCHEMA_DIR }}
run: |
echo "Configuring git..."
git config user.name "github-actions"
git config user.email "github-actions@users.noreply.github.com"
- name: Commit files
working-directory: ${{ env.SCHEMA_DIR }}
run: |
echo "Running git commit..."
git add .
git commit -m "Auto-commit of schema build for ${{ github.repository }}@${{ github.sha }}"
- name: Push changes to SCHEMA
working-directory: ${{ env.SCHEMA_DIR }}
run: git push origin HEAD:$SCHEMA_BRANCH
### PUBLISHING THE GUIDELINES ###
- name: Checkout GUIDELINES_REPO into GUIDELINES_DIR
uses: actions/checkout@v2
with:
# repository to check out
repository: ${{ env.GUIDELINES_REPO }}
# Deploy key as secret for accessing <owner>/<GUIDELINES_REPO>;
# cf. explanation in https://github.com/rism-ch/verovio/pull/1751
ssh-key: ${{ secrets.GH_ACTIONS_DEPLOY_KEY_GUIDELINES }}
# ref (branch, tag or SHA) to check out
ref: ${{ env.GUIDELINES_BRANCH }}
# relative path under $GITHUB_WORKSPACE to place the repository
path: ${{ env.GUIDELINES_DIR }}
- name: Copy built guidelines to GUIDELINES_DIR
run: |
rm -rf $GUIDELINES_DIR/dev
cp -r dist/guidelines/dev/web $GUIDELINES_DIR/
mv $GUIDELINES_DIR/web $GUIDELINES_DIR/dev
- name: Check git status before commit
working-directory: ${{ env.GUIDELINES_DIR }}
run: |
git config --get remote.origin.url
git status
- name: Configure git
working-directory: ${{ env.GUIDELINES_DIR }}
run: |
echo "Configuring git..."
git config user.name "github-actions"
git config user.email "github-actions@users.noreply.github.com"
- name: Commit files
working-directory: ${{ env.GUIDELINES_DIR }}
run: |
echo "Running git commit..."
git add .
git commit -m "Auto-commit of guidelines build for ${{ github.repository }}@${{ github.sha }}"
- name: Push changes to GUIDELINES
working-directory: ${{ env.GUIDELINES_DIR }}
run: git push origin HEAD:$GUIDELINES_BRANCH