Skip to content

Commit

Permalink
Add GitHub actions for releasing workshops.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Aug 12, 2024
1 parent 5363bdf commit 66c78ac
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 6 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/publish-workshops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
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]+"
branches:
- main
- develop
workflow_dispatch:

jobs:
publish-workshops:
runs-on: ubuntu-latest

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: |
imgpkg pull -i ghcr.io/vmware-tanzu-labs/educates-client-programs:2.7.2 -o /tmp/client-programs
mv /tmp/client-programs/educates-linux-amd64 /usr/local/bin/educates
- name: Setup repository variables and release details
shell: bash
run: |
REPOSITORY_NAME=${{github.event.repository.name}}
echo "REPOSITORY_NAME=${REPOSITORY_NAME,,}" >>${GITHUB_ENV}
echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
echo "REPOSITORY_TAG=${GITHUB_REF##*/}" >>${GITHUB_ENV}
- name: Publish workshops and create workshop definitions
shell: bash
run: |
for WORKSHOP_DIRECTORY in workshops/*; do
mkdir -p ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources
educates publish-workshop ${WORKSHOP_DIRECTORY} \
--export-workshop ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources/workshop.yaml \
--image-repository=ghcr.io/${REPOSITORY_OWNER} \
--workshop-version=${REPOSITORY_TAG} \
--registry-username=${{github.actor}} \
--registry-password=${{secrets.GITHUB_TOKEN}}
done
- name: Generate archives containing the workshop definitions
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 for the workshops
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{env.REPOSITORY_TAG}}
name: ${{env.REPOSITORY_NAME}}:${{env.REPOSITORY_TAG}}
draft: false
prerelease: false
files: |
${{runner.temp}}/workshops.tar.gz
${{runner.temp}}/workshops.zip
${{runner.temp}}/workshops.yaml
resources/trainingportal.yaml
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Educates Installation
=====================

This repository contains a set of workshops for learning about how to install
and configure Educates. The workshops are:

* [Installation using the CLI](workshops/lab-installation-via-cli ) - Workshop on installing Educates using the CLI.
* [Lookup Service Installation](workshops/lab-lookup-installation) - Workshop on installing the Educates lookup service.
* [Lookup Service Configuration](workshops/lab-lookup-configuration) - Workshop on configuring the Educates lookup service.
25 changes: 25 additions & 0 deletions resources/trainingportal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: training.educates.dev/v1beta1
kind: TrainingPortal
metadata:
name: labs-installation-guides
spec:
portal:
title: Educates Installation
registration:
type: anonymous
updates:
workshop: true
sessions:
maximum: 1
workshop:
defaults:
reserved: 1
initial: 0
expires: 30m
overtime: 10m
deadline: 60m
orphaned: 5m
workshops:
- name: lab-installation-via-cli
- name: lab-lookup-installation
- name: lab-lookup-configuration
4 changes: 2 additions & 2 deletions workshops/lab-installation-via-cli/resources/workshop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ spec:
title: "Educates installation using the CLI"
description: "A workshop on installing Educates using the CLI."
publish:
image: "$(image_repository)/lab-installation-via-cli-files:$(workshop_version)"
image: "$(image_repository)/labs-installation-guides/lab-installation-via-cli-files:$(workshop_version)"
workshop:
files:
- image:
url: "$(image_repository)/lab-installation-via-cli-files:$(workshop_version)"
url: "$(image_repository)/labs-installation-guides/lab-installation-via-cli-files:$(workshop_version)"
includePaths:
- /workshop/**
- /exercises/**
Expand Down
4 changes: 2 additions & 2 deletions workshops/lab-lookup-configuration/resources/workshop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ spec:
title: "Lookup Service Configuration"
description: "A workshop on configuring the lookup service."
publish:
image: "$(image_repository)/lab-lookup-configuration-files:$(workshop_version)"
image: "$(image_repository)/labs-installation-guides/lab-lookup-configuration-files:$(workshop_version)"
workshop:
files:
- image:
url: "$(image_repository)/lab-lookup-configuration-files:$(workshop_version)"
url: "$(image_repository)/labs-installation-guides/lab-lookup-configuration-files:$(workshop_version)"
includePaths:
- /workshop/**
- /exercises/**
Expand Down
4 changes: 2 additions & 2 deletions workshops/lab-lookup-installation/resources/workshop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ spec:
title: "Lookup Service Installation"
description: "A workshop on installing the lookup service."
publish:
image: "$(image_repository)/lab-lookup-installation-files:$(workshop_version)"
image: "$(image_repository)/labs-installation-guides/lab-lookup-installation-files:$(workshop_version)"
workshop:
files:
- image:
url: "$(image_repository)/lab-lookup-installation-files:$(workshop_version)"
url: "$(image_repository)/labs-installation-guides/lab-lookup-installation-files:$(workshop_version)"
includePaths:
- /workshop/**
- /exercises/**
Expand Down

0 comments on commit 66c78ac

Please sign in to comment.