deploy-codespace-template #134
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: deploy-codespace-template | |
| on: | |
| # Runs on completion of the deploy-stable workflow | |
| workflow_run: | |
| workflows: ["deploy-stable"] | |
| branches: ["main"] | |
| types: | |
| - completed | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| - name: Checkout codespace | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: PreTeXtBook/pretext-codespace | |
| token: ${{ secrets.PUSH_CODESPACES }} | |
| - name: Install pretext | |
| run: | | |
| python -m ensurepip | |
| python -m pip install --upgrade pip | |
| python -m pip install --upgrade pretext | |
| python -m pretext --version | |
| - name: pretext new hello | |
| shell: bash | |
| run: | | |
| rm -rf * | |
| rm -rf .devcontainer | |
| rm -rf .gitignore | |
| python -m pretext new hello -d . | |
| - name: setup git config | |
| run: | | |
| # setup the username and email. | |
| git config user.name ${{ github.actor }} | |
| git config user.email ${{ github.actor }}@users.noreply.github.com | |
| - name: restore previous files | |
| run: | | |
| git restore README.md | |
| git restore LICENSE | |
| - name: commit (only .devcontainer and .gitignore files) | |
| run: | | |
| # Stage the file, commit and push | |
| git add .devcontainer/* | |
| git add .gitignore | |
| git commit -m "update to latest `devcontainer files`" || echo "No new commit needed" | |
| git push origin main || echo "All done" |