Repository navigation
landing: ndarray v0.38.0 #189
Workflow file for this run
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
| # Build + deploy the Hugo site to GitHub Pages on every push to main. | |
| # Adapted from the official Hugo template at | |
| # https://gohugo.io/host-and-deploy/host-on-github-pages/. | |
| name: Deploy Hugo site to Pages | |
| on: | |
| push: | |
| branches: [main] | |
| # Build on every pull request too, so a change to the layout, the content or | |
| # the Hugo version has to prove the site still builds before it lands. | |
| # Without this the workflow ran only on main, which meant a dependency bump | |
| # arrived with no signal at all -- its checks read "no checks", which is not | |
| # the same thing as green and must not be merged as if it were. | |
| pull_request: | |
| workflow_dispatch: | |
| # Allow only one concurrent deployment, skipping runs queued between | |
| # the run in-progress and latest queued. Don't cancel in-progress | |
| # runs — we want them to finish before a new build replaces them. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| # The build needs nothing beyond the source and the Pages configuration it | |
| # reads to compute the base URL. Publishing rights are granted to the deploy | |
| # job alone, below, so a pull request build cannot replace what is served. | |
| permissions: | |
| contents: read | |
| pages: read | |
| env: | |
| # Pin Hugo so site builds don't break when a new release ships | |
| # incompatible template changes. Bump deliberately, not by | |
| # surprise. | |
| HUGO_VERSION: 0.135.0 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install Hugo CLI | |
| run: | | |
| wget -O hugo.deb "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb" | |
| sudo dpkg -i hugo.deb | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v6 | |
| # The playground's three assets are build artifacts, never committed: the | |
| # wasm compiled from playground/ at this commit, the Ruby tab's | |
| # interpreter (go-embedded-ruby at the version playground/rubywasm/go.mod | |
| # pins), and wasm_exec.js taken from the SAME toolchain (all must match). | |
| # Built before Hugo, which reads the two wasm sizes for the progress bars. | |
| - name: Setup Go | |
| uses: actions/setup-go@v7 | |
| with: | |
| go-version: "1.27.3" | |
| cache-dependency-path: | | |
| playground/go.sum | |
| playground/rubywasm/go.sum | |
| - name: Build the playground | |
| working-directory: playground | |
| env: | |
| GOWORK: "off" | |
| GOTOOLCHAIN: local | |
| run: | | |
| mkdir -p ../static/playground | |
| GOOS=js GOARCH=wasm go build -trimpath \ | |
| -ldflags "-s -w -X main.buildVersion=$(git rev-parse --short HEAD)" \ | |
| -o ../static/playground/playground.wasm ./cmd/playground-wasm | |
| cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" ../static/playground/ | |
| # Fetched by the page only when a visitor opens the Ruby tab. | |
| - name: Build go-embedded-ruby for the Ruby tab | |
| working-directory: playground/rubywasm | |
| env: | |
| GOWORK: "off" | |
| GOTOOLCHAIN: local | |
| run: | | |
| GOOS=js GOARCH=wasm go build -tags rbgo_core -trimpath -ldflags "-s -w" \ | |
| -o ../../static/playground/rbgo.wasm github.com/go-embedded-ruby/ruby/cmd/wasm | |
| raw=$(stat -c %s ../../static/playground/rbgo.wasm); gz=$(gzip -9 -c ../../static/playground/rbgo.wasm | wc -c) | |
| echo "rbgo.wasm ($(go list -m -f '{{.Version}}' github.com/go-embedded-ruby/ruby)): $raw bytes, $gz gzipped" | tee -a "$GITHUB_STEP_SUMMARY" | |
| - name: Build | |
| env: | |
| HUGO_ENVIRONMENT: production | |
| HUGO_ENV: production | |
| # Cache-busts the playground assets: a new deploy is a new URL. | |
| HUGO_PARAMS_WASMSHA: ${{ github.sha }} | |
| run: | | |
| hugo \ | |
| --gc \ | |
| --minify \ | |
| --baseURL "${{ steps.pages.outputs.base_url }}/" | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: ./public | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Only main publishes. A pull request stops after build above: it has built | |
| # the site, which is the whole point of the gate, and it has no business | |
| # replacing what is served. | |
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |