diff --git a/.github/workflows/deploy-pages.yaml b/.github/workflows/deploy-pages.yaml new file mode 100644 index 0000000..e6ada33 --- /dev/null +++ b/.github/workflows/deploy-pages.yaml @@ -0,0 +1,28 @@ +on: + push: + branches: + - main +jobs: + deploy-pages: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + + - name: Install and build examples + run: | + mkdir gh-pages + zip -r gh-pages/p13n.tutorial.zip exercises/ex01/sample.p13n + + for dir in exercises/ex*; do + mkdir -p gh-pages/"$dir"/sample.p13n + cd "$dir"/sample.p13n + npm install + npm run build + mv dist ../../../gh-pages/"$dir"/sample.p13n + cd ../../.. + done + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: gh-pages \ No newline at end of file diff --git a/.github/workflows/on-commit.yaml b/.github/workflows/on-commit.yaml deleted file mode 100644 index b8293f7..0000000 --- a/.github/workflows/on-commit.yaml +++ /dev/null @@ -1,37 +0,0 @@ -on: - push: - branches: - - typescript-and-es8-changes -jobs: - on-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - cache: 'npm' - cache-dependency-path: 'sample.p13n/package-lock.json' - - run: | - git config user.name github-actions - git config user.email github-actions@github.com - cd exercises/ex01 - zip -r ../../p13n.tutorial.zip sample.p13n - cd ../../ - git add p13n.tutorial.zip - git commit -m "update p13n.tutorial.zip" - mkdir tmp - cp exercises/ex01/sample.p13n/*.* tmp - cd tmp - npm i - mkdir webapp - for dir in ../exercises/ex*; do - cp -r "$dir"/sample.p13n/webapp/* ./webapp - npm run build - mv dist "$dir"/sample.p13n/ - rm -rf webapp/* - done - cd ../ - rm -rf tmp - git add exercises - git commit -m "update ghpages" - git push -f origin typescript-and-es8-changes:ghpages \ No newline at end of file