-
-
Notifications
You must be signed in to change notification settings - Fork 34
67 lines (63 loc) · 2.12 KB
/
cd.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
name: Synchronize the example with the template
on:
push:
branches: [main]
jobs:
synchronize_example:
runs-on: ubuntu-latest
env:
PROJECT_NAME: rust-gh-example
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run cargo generate
uses: cargo-generate/[email protected]
with:
name: ${{ env.PROJECT_NAME }}
template: template
arguments: "--template-values-file .github/workflows/template_values.toml --verbose"
- name: Checkout old example
uses: actions/checkout@v4
with:
repository: rust-github/rust-gh-example
path: old_example
ssh-key: ${{ secrets.GH_EXAMPLE_DEPLOY_SECRET }}
- name: move sources, mit license and Cargo.toml from old to new example
run: |
echo "pwd:"
pwd
echo "ls -al:"
ls -al
rm rust-gh-example/src/main.rs
rm rust-gh-example/Cargo.toml
rm rust-gh-example/LICENSE-MIT
cp old_example/src/* rust-gh-example/src/
cp old_example/Cargo.toml rust-gh-example/Cargo.toml
cp old_example/LICENSE-MIT rust-gh-example/LICENSE-MIT
- name: update example
run: |
mkdir old_sources
mv old_example/src/* old_sources
cd old_example
rm -rf * .gitignore .github/
echo "ls ../rust-gh-example:"
ls ../rust-gh-example
echo "ls ../rust-gh-example/src:"
ls ../rust-gh-example/src
mv ../rust-gh-example/* ../rust-gh-example/.github ../rust-gh-example/.gitignore .
echo "ls -al:"
ls -al
rm src/*
mv ../old_sources/* src
- name: commit example
run: |
cd old_example
git config user.name github-actions
git config user.email [email protected]
git add .
if [ -n "$(git status --porcelain)" ]; then
git commit -m "automatic update" -m "from $GITHUB_REPOSITORY@$GITHUB_SHA"
git push
else
echo "nothing to commit";
fi