-
-
Notifications
You must be signed in to change notification settings - Fork 29
114 lines (110 loc) · 3.58 KB
/
library-builder.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Library Builder
on:
workflow_dispatch:
inputs: { }
jobs:
generate-workdir:
name: Generate the working directory
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: "Setup NodeJs"
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: "Cache the dependencies"
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node18-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node18-
- name: "Install dependencies"
run: npm ci --no-progress
- name: "Generate the workdir"
run: npm run generate:workdir
- name: "Tar tmp directory"
run: |
mkdir -p .tmp
tar cf tmp.tar .tmp
working-directory: .workdir
- name: "Upload the workdir"
uses: actions/upload-artifact@v3
with:
name: workdir
path: |
.workdir/tmp.tar
.workdir/source
.workdir/library.yaml
generate-package:
name: Generate a package
runs-on: ubuntu-22.04
strategy:
matrix:
PACKAGE_URN:
- aws-q2-2022
- azure-6
- c4model
- c4nord
- domainstorytelling
- eip-1
- eventstorming
- fontawesome-6
- gcp
- homecloud-2
- material-4
- simpleicons-7
container: docker://thibaultmorin/plantuml-generator:1
needs: [ generate-workdir ]
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- uses: actions/download-artifact@v3
with:
name: workdir
- name: "Provide the .tmp directory"
run: tar xf tmp.tar
- name: "Delete package directory"
run: rm -Rf "distribution/${{ matrix.PACKAGE_URN }}"
- name: "Generate the package"
run: plantuml-generator library generate library.yaml --urn "${{ matrix.PACKAGE_URN }}" --clean-urn "${{ matrix.PACKAGE_URN }}"
- name: "Tar the package directory"
run: tar cf "${{ matrix.PACKAGE_URN }}-distribution.tar" "distribution/${{ matrix.PACKAGE_URN }}"
- name: "Upload the package directory"
uses: actions/upload-artifact@v3
with:
name: "${{ matrix.PACKAGE_URN }}-distribution"
path: "${{ matrix.PACKAGE_URN }}-distribution.tar"
push-distribution:
name: Push the distribution
runs-on: ubuntu-22.04
needs: [ generate-package ]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: "Refresh the distribution directory"
run: |
set -ex
for tar_path in `find . -name "*-distribution.tar"`
do
tar_name=$(basename "$tar_path")
package_urn="${tar_name%-*}"
rm -Rf "distribution/$package_urn"
tar xf "$tar_path"
done
rm -Rf *-distribution
rm -Rf workdir
- run: ls -hla
- name: "Commit changes"
run: |
git config --local user.email "[email protected]"
git config --local user.name "package_builder"
git add -A
git commit -m "feat: refresh the library"
- name: "Push the changes"
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}