|
| 1 | +--- |
| 2 | +name: Build Anki deck |
| 3 | +on: push |
| 4 | +jobs: |
| 5 | + build-anki-deck: |
| 6 | + name: Build Anki deck |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@master |
| 10 | + - name: Set up Python 3.9 |
| 11 | + uses: actions/setup-python@v1 |
| 12 | + with: |
| 13 | + python-version: 3.9 |
| 14 | + - name: Install requirements |
| 15 | + run: pip install -r requirements.txt |
| 16 | + - name: Test build Anki Deck |
| 17 | + run: python generate.py --stop 3 |
| 18 | + env: |
| 19 | + LEETCODE_CSRF_TOKEN: ${{ secrets.LEETCODE_CSRF_TOKEN }} |
| 20 | + LEETCODE_SESSION_ID: ${{ secrets.LEETCODE_SESSION_ID }} |
| 21 | + - name: Build Anki Deck |
| 22 | + run: python generate.py |
| 23 | + env: |
| 24 | + LEETCODE_CSRF_TOKEN: ${{ secrets.LEETCODE_CSRF_TOKEN }} |
| 25 | + LEETCODE_SESSION_ID: ${{ secrets.LEETCODE_SESSION_ID }} |
| 26 | + - name: Create Release |
| 27 | + id: create_release |
| 28 | + uses: actions/create-release@v1 |
| 29 | + env: |
| 30 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + with: |
| 32 | + tag_name: ${{ github.ref }} |
| 33 | + release_name: Release ${{ github.ref }} |
| 34 | + draft: true |
| 35 | + prerelease: true |
| 36 | + - name: Upload release asset |
| 37 | + uses: actions/upload-release-asset@v1 |
| 38 | + env: |
| 39 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + with: |
| 41 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 42 | + asset_path: ./leetcode.apkg |
| 43 | + asset_name: leetcode.apkg |
| 44 | + asset_content_type: application/octet-stream |
| 45 | + - name: Publish release |
| 46 | + uses: StuYarrow/publish-release@v1 |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + with: |
| 50 | + id: ${{ steps.create_release.outputs.id }} |
0 commit comments