|
| 1 | +name: Publish Workshops |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "[0-9]+.[0-9]+" |
| 7 | + - "[0-9]+.[0-9]+-alpha.[0-9]+" |
| 8 | + - "[0-9]+.[0-9]+-beta.[0-9]+" |
| 9 | + - "[0-9]+.[0-9]+-rc.[0-9]+" |
| 10 | + |
| 11 | +jobs: |
| 12 | + publish-workshops: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v3 |
| 18 | + |
| 19 | + - name: Install Carvel tools |
| 20 | + shell: bash |
| 21 | + run: curl -L https://carvel.dev/install.sh | bash |
| 22 | + |
| 23 | + - name: Install Educates CLI |
| 24 | + shell: bash |
| 25 | + run: | |
| 26 | + # curl -Lo /usr/local/bin/educates https://github.com/vmware-tanzu-labs/educates-training-platform/releases/download/2.6.0-alpha.31/educates-linux-amd64 |
| 27 | + # chmod +x /usr/local/bin/educates |
| 28 | + imgpkg pull -i ghcr.io/vmware-tanzu-labs/educates-client-programs:2.6.0-alpha.31 -o /tmp/client-programs |
| 29 | + mv /tmp/client-programs/educates-linux-amd64 /usr/local/bin/educates |
| 30 | +
|
| 31 | + - name: Setup repository variables and release details |
| 32 | + shell: bash |
| 33 | + run: | |
| 34 | + echo REPOSITORY_OWNER=$(echo "${{github.repository_owner}}" | tr '[:upper:]' '[:lower:]') >>${GITHUB_ENV} |
| 35 | + echo REPOSITORY_NAME=${{github.event.repository.name}} >>${GITHUB_ENV} |
| 36 | + echo REPOSITORY_TAG=$(echo "${{github.ref}}" | sed -e 's%refs/tags/%%') >>${GITHUB_ENV} |
| 37 | +
|
| 38 | + - name: Publish workshops and create workshop definitions |
| 39 | + shell: bash |
| 40 | + run : | |
| 41 | + for WORKSHOP_DIRECTORY in workshops/*; do |
| 42 | + mkdir -p ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources |
| 43 | + educates publish-workshop ${WORKSHOP_DIRECTORY} \ |
| 44 | + --export-workshop ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources/workshop.yaml \ |
| 45 | + --image-repository=ghcr.io/${REPOSITORY_OWNER} \ |
| 46 | + --workshop-version=${REPOSITORY_TAG} \ |
| 47 | + --registry-username=${{github.actor}} \ |
| 48 | + --registry-password=${{secrets.GITHUB_TOKEN}} |
| 49 | + done |
| 50 | +
|
| 51 | + - name: Generate archives containing the workshop definitions |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + ytt -f ${{runner.temp}}/workshops > ${{runner.temp}}/workshops.yaml |
| 55 | + (cd ${{runner.temp}}; tar cvfz workshops.tar.gz workshops) |
| 56 | + (cd ${{runner.temp}}; zip workshops.zip -r workshops) |
| 57 | +
|
| 58 | + - name: Create the GitHub release for the workshops |
| 59 | + id: create_release |
| 60 | + uses: softprops/action-gh-release@v1 |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 63 | + with: |
| 64 | + tag_name: ${{env.REPOSITORY_TAG}} |
| 65 | + name: ${{env.REPOSITORY_NAME}}:${{env.REPOSITORY_TAG}} |
| 66 | + draft: false |
| 67 | + prerelease: false |
| 68 | + files: | |
| 69 | + ${{runner.temp}}/workshops.tar.gz |
| 70 | + ${{runner.temp}}/workshops.zip |
| 71 | + ${{runner.temp}}/workshops.yaml |
| 72 | + resources/trainingportal.yaml |
0 commit comments