123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429 |
- # Release workflow
- #
- # We parallelize builds, dump all the artifacts into a release, and then publish the release
- # This guarantees everything is properly built and cached in case anything goes wrong
- #
- # The artifacts also need to get pushed to the various places
- # - the CLI goes to the releases page for binstall
- # - the extension goes to the marketplace
- # - the docs go to the website
- #
- # We need to be aware of the channel we're releasing
- # - prerelease is master
- # - stable is whatever the latest stable release is (ie 0.4 or 0.5 or 0.6 etc)
- #
- # In theory, we could trigger this workflow and set the channel accordingly
- on:
- workflow_dispatch:
- inputs:
- channel:
- type: choice
- description: "Branch to publish"
- required: true
- description: Choose the branch to publish. If the branch is main, it will publish a prerelease.
- # add more options as we release more stable versions.
- # todo: automate branch selection
- options:
- - v0.4.x
- - v0.5.x
- - main
- jobs:
- # Build the CLI for all platforms
- build-cli:
- permissions:
- contents: write
- runs-on: ${{ matrix.platform.os }}
- strategy:
- matrix:
- platform:
- - {
- target: x86_64-pc-windows-msvc,
- os: windows-latest,
- toolchain: "1.70.0",
- }
- - {
- target: x86_64-apple-darwin,
- os: macos-latest,
- toolchain: "1.70.0",
- }
- - {
- target: x86_64-unknown-linux-gnu,
- os: ubuntu-latest,
- toolchain: "1.70.0",
- }
- steps:
- - uses: actions/checkout@v4
- ref: ${{ github.event.inputs.channel }}
- - name: Install stable
- uses: dtolnay/rust-toolchain@master
- with:
- toolchain: ${{ matrix.platform.toolchain }}
- targets: ${{ matrix.platform.target }}
- - uses: ilammy/setup-nasm@v1
- - name: Setup cache
- uses: Swatinem/rust-cache@v2
- # cache only the cli - mmmm not sure if this is needed
- with:
- workspaces: packages/cli -> ../../target
- # Build the vscode extension
- build-extension:
- # Build the docs
- build-docs:
- # Run benchmarks, which we'll use to display on the website
- build-benchmarks:
- # And then do the releases, once everything is built
- # This should involve no rust and just pull down the artifacts
- release:
- depends-on: [build-cli, build-extension, build-docs, build-benchmarks]
- # Checkout the right branch
- - uses: actions/checkout@v4
- ref: ${{ github.event.inputs.channel }}
- # Before anything else, we need to publish the crates
- # todo: set the semver based on the channel
- # - all semver is a minor bump,
- # - if it's main, it's a prerelease, so use the prerelease flag
- - name: Publish to crates.io
- run: |
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
- git config --global user.name "github-actions[bot]"
- # cargo workspaces version -y ${{ github.event.inputs.semver }}
- # cargo workspaces publish -y ${{ github.event.inputs.semver }}
- # Todo: we want `cargo install dx` to actually just use a prebuilt binary
- - name: Build and upload CLI binaries
- uses: taiki-e/upload-rust-binary-action@v1
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- target: ${{ matrix.platform.target }}
- bin: dx
- archive: dx-${{ matrix.platform.target }}
- checksum: sha256
- manifest_path: packages/cli/Cargo.toml
- # build the docs, CLI, extension, and release
- jobs:
- build-deploy:
- runs-on: ubuntu-latest
- environment: docs
- steps:
- # install rust, etc, with caching, and do some checks
- - uses: actions/checkout@v4
- - run: sudo apt-get update
- - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
- - uses: dtolnay/rust-toolchain@stable
- - uses: Swatinem/rust-cache@v2
- with:
- cache-all-crates: "true"
- # save-if: ${{ github.ref == 'refs/heads/main' }} # always save the cache
- - name: Free Disk Space (Ubuntu)
- uses: jlumbroso/free-disk-space@v1.3.1
- with: # speed things up a bit
- large-packages: false
- docker-images: false
- swap-storage: false
- # Just make sure clippy is happy before doing anything else
- # Don't publish versions with clippy errors!
- - name: Clippy
- run: cargo clippy --workspace --all --examples --tests --all-features --all-targets -- -D warnings
- # Build the CLI... todo: do this in a matrix using binstall
- - name: Build CLI
- run: cargo build --release --bin dx
- - name: Build Extension
- run: cargo build --release --bin dx-ext
- - name: Bundle extension
- working-directory: ./packages/extension
- run: vsce package && mv *.vsix ../../dx-ext.vsix
- # Docs first...
- # NOTE: Delete when the previous one is enabled
- # NOTE: Comment out when https://github.com/rust-lang/mdBook/pull/1306 is merged and released
- # - name: Setup mdBook
- # uses: peaceiris/actions-mdbook@v1
- # with:
- # mdbook-version: "0.4.10"
- - name: Setup mdBook
- run: |
- cargo install mdbook --git https://github.com/Demonthos/mdBook.git --branch master
- - name: Build
- run: cd docs &&
- cd guide && mdbook build -d ../nightly/guide && cd .. &&
- cd router && mdbook build -d ../nightly/router && cd ..
- - name: Deploy docs 🚀
- uses: JamesIves/github-pages-deploy-action@v4.5.0
- with:
- branch: gh-pages # The branch the action should deploy to.
- folder: docs/nightly # The folder the action should deploy.
- target-folder: docs
- repository-name: dioxuslabs/docsite
- # Don't clean the existing files, so the old docs are still available.
- # todo: the history on the dociste is getting massive, so we should actually just be amending the commit
- clean: false
- token: ${{ secrets.DEPLOY_KEY }}
- # Then the CLI
- # Then the extension
- # Then the release itself
- # Release a number of things
- # - the extension
- # - the CLI
- # - nightly docs
- # - the website
- # - crates themselves
- # name: Publish to crates.io
- # on:
- # workflow_dispatch:
- # inputs:
- # semver:
- # type: choice
- # description: "Semver version to publish"
- # required: true
- # options:
- # - patch
- # - minor
- # - major
- # jobs:
- # publish:
- # runs-on: ubuntu-latest
- # steps:
- # - name: Checkout code
- # uses: actions/checkout@v2
- # - name: Set up Rust
- # uses: actions-rs/toolchain@v1
- # with:
- # toolchain: nightly
- # override: true
- # - name: Install cargo-workspaces
- # run: cargo install cargo-workspaces
- # - name: Login to crates.io
- # uses: actions-rs/cargo@v1
- # with:
- # toolchain: nightly
- # command: login
- # args: ${{ secrets.CRATES_TOKEN }}
- # - name: Publish to crates.io
- # run: |
- # git config --global user.email "github-actions[bot]@users.noreply.github.com"
- # git config --global user.name "github-actions[bot]"
- # # Release as-is
- # # This assumes the version tracking PR has been merged
- # # cargo workspaces changed
- # # # version will automatically commit back to the repo
- # # # cargo workspaces version -y ${{ github.event.inputs.semver }}
- # Whenever commits are merged to main, update or create a PR that bumps the version
- # Tracks if changes are semver compatible
- #
- # We want to have a standing "major" update PR and a standing "minor" update PR where fixes are backported
- #
- # Whenever a PR is merged, we want to attempt to update the major/minor bump PRs
- # - for main, it's as simple as running cargo workspaces version -y minor and dumping it into a PR
- # - for backport, it's a bit more complicated, since we need to know which branch is the latest stable release
- #
- # - We could make it so merging a PR with a "backport" label attempts to release it, using the target branch as the stable release
- # on:
- # push:
- # branches:
- # - master
- # # Generate the minor bump
- # jobs:
- # update_routes:
- # runs-on: ubuntu-latest
- # steps:
- # # Check out the repo, but don't persist credentials, so github uses the GITHUB_TOKEN
- # - uses: actions/checkout@v2
- # with:
- # persist-credentials: false
- # # Run cargo workspaces version to generate the version bump PR
- # - run: "date > datetime.txt" # create or update a test.txt file
- # # And then create the PR
- # - uses: gr2m/create-or-update-pull-request-action@v1
- # env:
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- # with:
- # title: "My pull request title"
- # body: "My pull request body"
- # branch: "my-pull-request-base-branch"
- # path: "lib/"
- # commit-message: "My commit message for uncommitted changes in lib/ folder"
- # author: "Lorem J. Ipsum <lorem@example.com>"
- # labels: label1, label2
- # assignees: user1, user2
- # reviewers: user1, user2
- # team_reviewers: team1, team2
- # auto-merge: squash
- # update-pull-request-title-and-body: false
- # # Generate the major bump
- # # # # publish will automatically commit back to the repo **AND** publish to crates.io
- # # # # cargo workspaces publish -y ${{ github.event.inputs.semver }}
- # name: Deploy Nightly Docs
- # on:
- # push:
- # branches:
- # - main
- # jobs:
- # deploy:
- # name: Build & Deploy
- # runs-on: ubuntu-latest
- # permissions:
- # contents: write
- # steps:
- # - uses: actions/checkout@v4
- # - run: sudo apt-get update
- # - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
- # - uses: dtolnay/rust-toolchain@nightly
- # with:
- # toolchain: nightly-2024-02-01
- # - uses: Swatinem/rust-cache@v2
- # with:
- # cache-all-crates: "true"
- # save-if: ${{ github.ref == 'refs/heads/main' }}
- # - uses: ilammy/setup-nasm@v1
- # - name: cargo doc
- # run: cargo doc --no-deps --workspace --all-features
- # - name: Deploy
- # uses: JamesIves/github-pages-deploy-action@v4.5.0
- # with:
- # branch: gh-pages
- # folder: target/doc
- # target-folder: api-docs/nightly
- # repository-name: dioxuslabs/docsite
- # clean: false
- # token: ${{ secrets.DEPLOY_KEY }}
- # name: docs stable
- # on:
- # workflow_dispatch:
- # concurrency:
- # group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
- # cancel-in-progress: true
- # jobs:
- # build-deploy:
- # runs-on: ubuntu-latest
- # environment: docs
- # steps:
- # # NOTE: Comment out when https://github.com/rust-lang/mdBook/pull/1306 is merged and released
- # # - name: Setup mdBook
- # # uses: peaceiris/actions-mdbook@v1
- # # with:
- # # mdbook-version: "0.4.10"
- # # NOTE: Delete when the previous one is enabled
- # - name: Setup mdBook
- # run: |
- # cargo install mdbook --git https://github.com/Demonthos/mdBook.git --branch master
- # - uses: actions/checkout@v4
- # - name: Build
- # run: cd docs &&
- # cd guide && mdbook build -d ../nightly/guide && cd .. &&
- # cd router && mdbook build -d ../nightly/router && cd ..
- # - name: Deploy 🚀
- # uses: JamesIves/github-pages-deploy-action@v4.5.0
- # with:
- # branch: gh-pages # The branch the action should deploy to.
- # folder: docs/nightly # The folder the action should deploy.
- # target-folder: docs
- # repository-name: dioxuslabs/docsite
- # clean: false
- # token: ${{ secrets.DEPLOY_KEY }} # let's pretend I don't need it for now
- # name: Build CLI for Release
- # # Will run automatically on every new release
- # on:
- # release:
- # types: [published]
- # jobs:
- # build-and-upload:
- # permissions:
- # contents: write
- # runs-on: ${{ matrix.platform.os }}
- # strategy:
- # matrix:
- # platform:
- # - {
- # target: x86_64-pc-windows-msvc,
- # os: windows-latest,
- # toolchain: "1.70.0",
- # }
- # - {
- # target: x86_64-apple-darwin,
- # os: macos-latest,
- # toolchain: "1.70.0",
- # }
- # - {
- # target: x86_64-unknown-linux-gnu,
- # os: ubuntu-latest,
- # toolchain: "1.70.0",
- # }
- # steps:
- # - uses: actions/checkout@v4
- # - name: Install stable
- # uses: dtolnay/rust-toolchain@master
- # with:
- # toolchain: ${{ matrix.platform.toolchain }}
- # targets: ${{ matrix.platform.target }}
- # - uses: ilammy/setup-nasm@v1
- # # Setup the Github Actions Cache for the CLI package
- # - name: Setup cache
- # uses: Swatinem/rust-cache@v2
- # with:
- # workspaces: packages/cli -> ../../target
- # # This neat action can build and upload the binary in one go!
- # - name: Build and upload binary
- # uses: taiki-e/upload-rust-binary-action@v1
- # with:
- # token: ${{ secrets.GITHUB_TOKEN }}
- # target: ${{ matrix.platform.target }}
- # bin: dx
- # archive: dx-${{ matrix.platform.target }}
- # checksum: sha256
- # manifest_path: packages/cli/Cargo.toml
|