-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.66 KB
/
publish-workshops.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
name: Publish Workshops
on:
push:
tags:
- "[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+-alpha.[0-9]+"
- "[0-9]+.[0-9]+-beta.[0-9]+"
- "[0-9]+.[0-9]+-rc.[0-9]+"
jobs:
publish-workshops:
runs-on: ubuntu-latest
if: ${{github.repository != 'vmware-tanzu-labs/educates-workshop-templates'}}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Carvel tools
shell: bash
run: curl -L https://carvel.dev/install.sh | bash
- name: Install Educates CLI
shell: bash
run: |
# curl -Lo /usr/local/bin/educates https://github.com/vmware-tanzu-labs/educates-training-platform/releases/download/2.6.0-alpha.25/educates-linux-amd64
# chmod +x /usr/local/bin/educates
imgpkg pull -i ghcr.io/vmware-tanzu-labs/educates-client-programs:2.6.0-alpha.25 -o /tmp/client-programs
mv /tmp/client-programs/educates-linux-amd64 /usr/local/bin/educates
- name: Setup the list of workshop names
shell: bash
run: |
echo WORKSHOPS="lab-builtin-vcluster,lab-shared-vcluster,lab-remote-cluster" >>${GITHUB_ENV}
echo REPOSITORY_OWNER=$(echo "${{github.repository_owner}}"" | tr '[:upper:]' '[:lower:]') >>${GITHUB_ENV}
echo REPOSITORY_TAG=$(echo "${{github.ref}}" | sed -e 's%refs/tags/%%') >>${GITHUB_ENV}
- name: Publish workshops and create workshop definition
shell: bash
run : |
for WORKSHOP in $(echo "$WORKSHOPS" | tr ',' '\n'); do
mkdir -p ${{runner.temp}}/workshops/${WORKSHOP}
educates publish-workshop workshops/${WORKSHOP} \
--export-workshop ${{runner.temp}}/workshops/${WORKSHOP}/workshop.yaml \
--repository=ghcr.io/${REPOSITORY_OWNER} \
--workshop-version=${REPOSITORY_TAG} \
--registry-username=${{github.actor}} \
--registry-password=${{secrets.GITHUB_TOKEN}}
done
- name: Generate release files for workshops
shell: bash
run: |
ytt -f ${{runner.temp}}/workshops > ${{runner.temp}}/workshops.yaml
(cd ${{runner.temp}}; tar -cvfz workshops.tar.gz workshops)
(cd ${{runner.temp}}; zip workshops.zip -r workshops)
- name: Create the GitHub release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${REPOSITORY_TAG}
name: ${{github.repository_name}}:${REPOSITORY_TAG}
draft: false
prerelease: false
files: |
${{runner.temp}}/workshops.tar.gz
${{runner.temp}}/workshops.zip
${{runner.temp}}/workshops.yaml
resources/trainingportal.yaml