wip: consolidate release

This commit is contained in:
Jonathan Kelley committed 2024-02-21 19:36:33 -08:00
1 parent 37b8fd0135
commit 8f70f8936f
12 files changed
+451 -289

No files matched your search

+1
View File
@@ -1,6 +1,7 @@
# Attempt to backport a merged pull request to the latest stable release
#
# If the backported PR is succesfully merged
# Any PR without the "breaking" label will be attempted to be backported to the latest stable release
name: Backport merged pull request
on:
-56
View File
@@ -1,56 +0,0 @@
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
-43
View File
@@ -1,43 +0,0 @@
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 ..
# cd reference && mdbook build -d ../nightly/reference && cd .. &&
# cd fermi && mdbook build -d ../nightly/fermi && 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
-38
View File
@@ -1,38 +0,0 @@
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 }}
+21 -1
View File
@@ -75,7 +75,6 @@ jobs:
large-packages: false
docker-images: false
swap-storage: false
- run: cargo make tests
fmt:
@@ -112,6 +111,27 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings
# Only run semver checks if the PR is not a draft and does not have the breaking label
# Breaking PRs don't need to follow semver since they are breaking changes
# However, this means we won't attempt to backport them, so you should be careful about using this label, as it will
# likely make future backporting difficult
semver:
if: github.event.pull_request.draft == false
if: ${{ !contains(github.event.pull_request.labels.*.name, 'breaking') }}
name: Semver Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ilammy/setup-nasm@v1
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
- run: cargo semver-checks check-release --workspace --exclude "dioxus-cli, dioxus-ext"
playwright:
if: github.event.pull_request.draft == false
name: Playwright Tests
+4
View File
@@ -0,0 +1,4 @@
# promote nightly to stable
#
# runs the various git commands to update the version
# should be followed up by a stable release
-53
View File
@@ -1,53 +0,0 @@
# 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 }}
# # publish will automatically commit back to the repo **AND** publish to crates.io
# # cargo workspaces publish -y ${{ github.event.inputs.semver }}
+423
View File
@@ -0,0 +1,423 @@
# 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: "Channel to publish"
required: true
description: Publish crates, extension, CLI, and docs
options:
- v0.4.x
- v0.5.x
- main
# todo: use better name scheme
# - stable # the currently released version of dioxus
# - prerelease # the next version of dioxus, which we release slowly
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
- 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
#
# 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
release:
depends-on: [build-cli, build-extension, build-docs, build-benchmarks]
# Before anything else, we need to publish the crates
- 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 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' }}
- 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
-47
View File
@@ -1,47 +0,0 @@
# Whenever commits are merged to main, update or create a PR that bumps the version
# Tracks if changes are semver compatible
# Most likely the changes aren't 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 made, we want to comment on it:
# - semver compatibility
# - if it's a fix, it should be backported to the minor update PR
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
-37
View File
@@ -1,37 +0,0 @@
name: Clear cache
on:
workflow_dispatch:
permissions:
actions: write
jobs:
clear-cache:
runs-on: ubuntu-latest
steps:
- name: Clear cache
uses: actions/github-script@v7
with:
github-token: ${{ secrets.cache_controller }}
script: |
console.log("About to clear")
while (true) {
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo
})
if (caches.data.actions_caches.length === 0) {
break
}
for (const cache of caches.data.actions_caches) {
console.log(cache)
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
}
console.log("Clear completed")