Skip to content

Bump brace-expansion from 2.0.1 to 2.0.2 in /toolbar-app #31

Bump brace-expansion from 2.0.1 to 2.0.2 in /toolbar-app

Bump brace-expansion from 2.0.1 to 2.0.2 in /toolbar-app #31

Workflow file for this run

name: Create Tutorial Workspace
on:
pull_request:
branches: ["main"]
types:
- closed
jobs:
create-workspace:
if: github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'Skip CI')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get changed files
id: get-changed-files
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32
- name: Get changed folder
id: get-changed-folder
env:
ALL_CHANGED_FILES: ${{ steps.get-changed-files.outputs.all_changed_files }}
run: |
first_file=$(echo "$ALL_CHANGED_FILES" | tr ' ' '\n' | grep "^tutorials/" | grep -v "^tutorials/00" | head -n 1)
top_level_dir=$(echo "$first_file" | cut -d'/' -f1,2)
echo "dir=$top_level_dir" >> "$GITHUB_OUTPUT"
- name: Check for config file
working-directory: ${{ steps.get-changed-folder.outputs.dir }}
run: |
pwd
if [ ! -f tutorial-config.json ]; then
echo "tutorial-config.json not found. Exiting."
exit 1
fi
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 22.4
- name: Install dependencies
working-directory: ${{ github.workspace }}/tutorials
run: |
node -v
npm -v
npm install
- name: Run build
working-directory: ${{ steps.get-changed-folder.outputs.dir }}
run: |
pwd
npm run build
- name: Prep deploy
id: prep-deploy
working-directory: ${{ steps.get-changed-folder.outputs.dir }}
run: |
NAME=${{ steps.get-changed-folder.outputs.dir }}
NAME=${NAME#*/}
VERSION=$(jq -r '.version' ./tutorial-config.json)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "name=$NAME" >> "$GITHUB_OUTPUT"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: "${{ steps.get-changed-folder.outputs.dir }}/dist"
publish_branch: gh_pages
destination_dir: "${{ steps.get-changed-folder.outputs.dir }}/${{ steps.prep-deploy.outputs.version }}"
- name: Create Workspace Folder
working-directory: ${{ steps.get-changed-folder.outputs.dir }}
run: |
mkdir -p ws
cd ws
cp ../tutorial-config.json .
cp ../README.md .
cp -r $GITHUB_WORKSPACE/scripting/TemplateWorkspace/. .
cp $GITHUB_WORKSPACE/scripting/createWorkspace.sh .
ls -a
./createWorkspace.sh https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ steps.get-changed-folder.outputs.dir }}/${{ steps.prep-deploy.outputs.version }}/
- name: Tag the commit
id: tag-commit
working-directory: ${{ steps.get-changed-folder.outputs.dir }}
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add --all
TAG_NAME="${{ steps.prep-deploy.outputs.name }}-v${{ steps.prep-deploy.outputs.version }}"
git commit -m "Adding workspace for ${TAG_NAME}"
git tag -a $TAG_NAME -m "Tagging commit for version ${TAG_NAME}"
git push
git push origin $TAG_NAME
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
- name: Zip Workspace
uses: TheDoctor0/[email protected]
with:
type: "zip"
directory: "${{ steps.get-changed-folder.outputs.dir }}/ws"
path: "."
filename: "ws.zip"
exclusions: "tutorial-config.json createWorkspace.sh"
- name: Upload a Build Artifact
id: upload-release-artifact
uses: actions/[email protected]
with:
path: "${{ steps.get-changed-folder.outputs.dir }}/ws/ws.zip"
- name: Create release assets
uses: ncipollo/release-action@v1
with:
name: Release ${{ steps.tag-commit.outputs.tag_name }}
artifacts: "${{ steps.get-changed-folder.outputs.dir }}/ws/ws.zip"
body: Download and Upload the ws.zip file to Code Hub now.
tag: ${{ steps.tag-commit.outputs.tag_name }}