Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully Automatic Releases (for book- repository series) #138

Open
2 tasks
mmcky opened this issue Mar 28, 2024 · 0 comments
Open
2 tasks

Fully Automatic Releases (for book- repository series) #138

mmcky opened this issue Mar 28, 2024 · 0 comments
Assignees

Comments

@mmcky
Copy link

mmcky commented Mar 28, 2024

Current the release of the book websites is a two step process:

  1. Setup a sync- release on the private repo
  2. Setup a publish- release on the public repo

This is not convenient. I have experimented with using gh cli to trigger releases on the public repository automatically but I haven't got the config correct after reading the github docs this morning.

We will need to

  • setup a test repositry
  • get gh cli working with ability to generate a release on another repo that will trigger an autobuild and publish.

Template action for test work.

name: Sync with book-dp1-public
on:
  push:
    tags:
      - 'sync*'
jobs:
  sync:
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Install Git (required to commit notebooks)
        shell: bash -l {0}
        run: apt-get install -y git
      - name: Sync assets to book-dp1-public
        shell: bash -l {0}
        env:
          QE_SERVICES_PAT: ${{ secrets.QUANTECON_SERVICES_PAT }}
        run: |
          git clone https://quantecon-services:[email protected]/quantecon/book-dp1-public
          
          cp book/dp.pdf book-dp1-public/pdf/
          
          cp slides/ch_0/ch_0.pdf book-dp1-public/slides/
          cp slides/ch_1/ch_1.pdf book-dp1-public/slides/
          cp slides/ch_2/ch_2.pdf book-dp1-public/slides/
          cp slides/ch_3/ch_3.pdf book-dp1-public/slides/
          cp slides/ch_4/ch_4.pdf book-dp1-public/slides/
          cp slides/ch_5/ch_5.pdf book-dp1-public/slides/
          cp slides/ch_6/ch_6.pdf book-dp1-public/slides/
          cp slides/ch_7/ch_7.pdf book-dp1-public/slides/
          cp slides/ch_8/ch_8.pdf book-dp1-public/slides/
          cp slides/ch_9/ch_9.pdf book-dp1-public/slides/
          cp slides/ch_10/ch_10.pdf book-dp1-public/slides/
          
          cp source_code_py/* book-dp1-public/code/py/
          cp source_code_jl/* book-dp1-public/code/jl/
          
          cd book-dp1-public
          git config user.name "QuantEcon Services"
          git config user.email "[email protected]"
          git add .
          git commit -m "auto sync from book-dp1"
          git push origin main
  publish:
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
    needs: sync
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Install Git and GH CLI (required to commit notebooks)
        shell: bash -l {0}
        run: |
          sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
          && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
          && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
          && sudo apt update \
          && sudo apt install gh -y  
          apt-get install -y git
      - name: Sync assets to book-dp1-public
        shell: bash -l {0}
        env:
          QE_SERVICES_PAT: ${{ secrets.QUANTECON_SERVICES_PAT }}
        run: |
          git clone https://quantecon-services:[email protected]/quantecon/book-dp1-public
          cd book-dp1-public
          DATE=$(date +%Y%b%d)
          gh release create publish-$DATE --generate-notes
@mmcky mmcky self-assigned this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant