|
| 1 | +name: gh-pages |
| 2 | + |
| 3 | +on: |
| 4 | + # Runs on pushes targeting the default branch |
| 5 | + push: |
| 6 | + paths-ignore: |
| 7 | + - README.md |
| 8 | + - CONTRIBUTING.md |
| 9 | + - LICENSE.md |
| 10 | + - .gitignore |
| 11 | + - '.github/**' |
| 12 | + branches: ["*"] |
| 13 | + release: |
| 14 | + types: |
| 15 | + - created |
| 16 | + - edited |
| 17 | + |
| 18 | + # Allows you to run this workflow manually from the Actions tab |
| 19 | + workflow_dispatch: |
| 20 | + |
| 21 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 22 | +permissions: |
| 23 | + contents: write |
| 24 | + pages: write |
| 25 | + id-token: write |
| 26 | + |
| 27 | +# Allow one concurrent deployment |
| 28 | +concurrency: |
| 29 | + group: "pages" |
| 30 | + cancel-in-progress: true |
| 31 | + |
| 32 | +jobs: |
| 33 | + build-and-deploy: |
| 34 | + environment: |
| 35 | + name: github-pages |
| 36 | + url: ${{ steps.deployment.outputs.page_url }} |
| 37 | + runs-on: ubuntu-latest |
| 38 | + env: |
| 39 | + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
| 40 | + steps: |
| 41 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 42 | + - uses: actions/checkout@v3 |
| 43 | + |
| 44 | + |
| 45 | + - name: Set up Go |
| 46 | + uses: actions/setup-go@v3 |
| 47 | + with: |
| 48 | + go-version: '1.20' |
| 49 | + |
| 50 | + - name: Install mmark |
| 51 | + run: go install github.com/mmarkdown/mmark@latest |
| 52 | + |
| 53 | + - name: Convert Markdown to RFC XML with MMark |
| 54 | + run: | |
| 55 | + mmark -2 openid-connect-key-binding-1_0.md > openid-connect-key-binding-1_0.xml |
| 56 | +
|
| 57 | + - name: Upload XML artifact |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: built-xml |
| 61 | + path: openid-connect-key-binding-1_0.xml |
| 62 | + |
| 63 | + |
| 64 | + - name: log XML file |
| 65 | + run: cat openid-connect-key-binding-1_0.xml |
| 66 | + |
| 67 | + - name: Set up Python |
| 68 | + uses: actions/setup-python@v4 |
| 69 | + with: |
| 70 | + python-version: '3.10' |
| 71 | + - name: Install xml2rfc |
| 72 | + run: pip install xml2rfc |
| 73 | + |
| 74 | + |
| 75 | + - name: Show env |
| 76 | + run: echo "$GITHUB_CONTEXT" |
| 77 | + |
| 78 | + - name: Create html folder |
| 79 | + run: mkdir html |
| 80 | + |
| 81 | + - name: Show folders |
| 82 | + run: ls -al |
| 83 | + |
| 84 | + - name: Show branch name |
| 85 | + run: echo "$BRANCH_NAME" |
| 86 | + |
| 87 | + - name: Render HTML |
| 88 | + run: xml2rfc --html openid-connect-key-binding-1_0.xml --out html/$BRANCH_NAME.html |
| 89 | + |
| 90 | + - name: Deploy to GitHub Pages |
| 91 | + if: success() |
| 92 | + uses: crazy-max/ghaction-github-pages@v2 |
| 93 | + with: |
| 94 | + target_branch: gh-pages |
| 95 | + build_dir: html |
| 96 | + keep_history: true |
| 97 | + env: |
| 98 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 99 | + |
| 100 | + |
| 101 | + # - name: Setup Pages |
| 102 | + # uses: actions/configure-pages@v5 |
| 103 | + |
| 104 | + # - name: Upload artifact |
| 105 | + # uses: actions/upload-pages-artifact@v3 |
| 106 | + # with: |
| 107 | + # # Upload entire repository |
| 108 | + # path: 'html' |
| 109 | + # env: |
| 110 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments