|
| 1 | +name: Build and publish drafts |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + pages: write |
| 12 | + id-token: write |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: pages |
| 16 | + cancel-in-progress: false |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + container: |
| 22 | + image: ubuntu:24.04 |
| 23 | + steps: |
| 24 | + - name: Install runner prerequisites |
| 25 | + run: | |
| 26 | + apt-get update |
| 27 | + apt-get install -y --no-install-recommends \ |
| 28 | + git ca-certificates curl build-essential libssl-dev libyaml-dev zlib1g-dev |
| 29 | +
|
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - uses: ruby/setup-ruby@97ecb7b512899eb71ab1bf2310a624c6f1589ac6 # v1.308.0 |
| 33 | + with: |
| 34 | + ruby-version: '3.3' |
| 35 | + |
| 36 | + - uses: actions/setup-python@v5 |
| 37 | + with: |
| 38 | + python-version: '3.12' |
| 39 | + |
| 40 | + - name: Install build tools |
| 41 | + run: | |
| 42 | + gem install kramdown-rfc |
| 43 | + pip install xml2rfc |
| 44 | +
|
| 45 | + - name: Build drafts |
| 46 | + run: make all xml |
| 47 | + |
| 48 | + - name: Stage site |
| 49 | + run: | |
| 50 | + mkdir -p _site |
| 51 | + cp -r assets _site/assets |
| 52 | +
|
| 53 | + for f in draft-*.html draft-*.txt draft-*.xml; do |
| 54 | + cp "$f" "_site/$f" |
| 55 | + done |
| 56 | +
|
| 57 | + { |
| 58 | + echo '<!doctype html>' |
| 59 | + echo '<html lang="en">' |
| 60 | + echo '<head>' |
| 61 | + echo '<meta charset="utf-8">' |
| 62 | + echo '<title>1Password Agent Identity Spec Drafts</title>' |
| 63 | + echo '<link rel="stylesheet" href="assets/1password.css">' |
| 64 | + echo '<style>body{max-width:48rem;margin:3rem auto;padding:0 1rem;font-family:system-ui,sans-serif;line-height:1.5;}ul{padding-left:0;list-style:none;}li{margin:1.25rem 0;}.formats a{margin-right:0.5rem;}</style>' |
| 65 | + echo '</head>' |
| 66 | + echo '<body>' |
| 67 | + echo '<h1>1Password Agent Identity Spec Drafts</h1>' |
| 68 | + echo '<ul>' |
| 69 | + for d in $(ls draft-*.html | sed 's/\.html$//' | sort -u); do |
| 70 | + echo "<li><a href=\"$d.html\"><strong>$d</strong></a><div class=\"formats\"><a href=\"$d.html\">HTML</a> · <a href=\"$d.txt\">Text</a> · <a href=\"$d.xml\">XML</a></div></li>" |
| 71 | + done |
| 72 | + echo '</ul>' |
| 73 | + echo '</body>' |
| 74 | + echo '</html>' |
| 75 | + } > _site/index.html |
| 76 | +
|
| 77 | + - name: Upload build artifacts |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: drafts |
| 81 | + path: | |
| 82 | + draft-*.xml |
| 83 | + draft-*.html |
| 84 | + draft-*.txt |
| 85 | +
|
| 86 | + - name: Upload Pages artifact |
| 87 | + if: github.ref == 'refs/heads/main' |
| 88 | + uses: actions/upload-pages-artifact@v3 |
| 89 | + with: |
| 90 | + path: _site |
| 91 | + |
| 92 | + deploy: |
| 93 | + if: github.ref == 'refs/heads/main' |
| 94 | + needs: build |
| 95 | + runs-on: ubuntu-latest |
| 96 | + container: |
| 97 | + image: ubuntu:24.04 |
| 98 | + environment: |
| 99 | + name: github-pages |
| 100 | + url: ${{ steps.deployment.outputs.page_url }} |
| 101 | + steps: |
| 102 | + - id: deployment |
| 103 | + uses: actions/deploy-pages@v4 |
0 commit comments