-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (109 loc) · 3.32 KB
/
continuous-deployment.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
name: Continous Deployment
on:
push:
branches:
- "**"
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build_matrix:
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.generate-matrix.outputs.branches }}
json_branches: ${{ steps.generate-matrix.outputs.json_branches }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Setup jq'
uses: dcarbone/[email protected]
- name: Generate Matrix
id: generate-matrix
run: |
branches=($(git branch -r | cut -c 3- | sed 's/origin\///g'))
json_branches=$(printf '%s\n' "${branches[@]}" | jq -R . | jq -s -c .)
echo "branches=${branches}" >> $GITHUB_OUTPUT
echo "json_branches=${json_branches}" >> $GITHUB_OUTPUT
branch_count=$(git branch -r | wc -l)
artifact_names="0"
for ((i = 1; i < $branch_count; i++))
do
artifact_names+=" ${i}"
done
echo "artifact_names=${artifact_names}" >> $GITHUB_OUTPUT
my_echo:
runs-on: ubuntu-latest
needs:
- build_matrix
steps:
- name: Echo previous outputs
run: echo "${{ toJSON(needs.build_matrix.outputs) }}"
build:
runs-on: ubuntu-latest
name: Build
needs:
- build_matrix
strategy:
matrix:
branch: ${{ fromJSON(needs.build_matrix.outputs.json_branches) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- uses: actions/setup-node@v4
with:
# Version Spec of the version to use in SemVer notation.
# It also emits such aliases as lts, latest, nightly and canary builds
# Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node
node-version: 20
- name: Build
run: |
npm install
npm run build
- uses: actions/upload-artifact@v3
with:
name: ${{ strategy.job-index }}
path: dist/cv/browser/
# - name: Build
# run: |
# git for-each-ref --shell \
# --format='git checkout \
# refs/heads/
deploy:
runs-on: ubuntu-latest
name: Deploy
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs:
- build_matrix
- build
steps:
- name: Setup Pages
uses: actions/configure-pages@v3
# - uses: actions/download-artifact@master
# with:
# name: my-artifact
# path: path/to/artifact
- name: Download multiple artifacts
uses: marcofaggian/action-download-multiple-artifacts@v1
with:
names: ${{ needs.build_matrix.outputs.artifact_names }}
paths: ${{ needs.build_matrix.outputs.branches }}
workflow: continuous-deployment.yml
- run: |
ls -a
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./dist/cv/browser/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2