Skip to content

Commit

Permalink
Add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn committed Nov 9, 2023
1 parent fba32b0 commit 6f99be5
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
push:
branches:
- '*'
- '!release'

name: format

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
override: true
- uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
93 changes: 93 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: release
on:
push:
branches:
- release
paths:
- "**/Cargo.toml"
- ".github/workflows/release.yml"

jobs:
git-tag:
runs-on: ubuntu-latest
steps:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Checkout
uses: actions/checkout@v4

- name: Get releasing version
working-directory: .
run: echo NEXT_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV

- name: Check published version
run: echo PREV_VERSION=$(cargo search glory
--limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV

- name: Auto tag latest version
uses: bullrich/commit-autotag@main
if: env.NEXT_VERSION != env.PREV_VERSION
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
strategy: regex
root: Cargo.toml
regex_pattern: "version\\s*=\\s*\"([0-9\\.]+)\""
tag_prefix: "v"
# version: "${{ env.NEXT_VERSION }}"

publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
package:
- crate: glory-hot-reload
path: crates/hot-reload
- crate: glory-core
path: crates/core
- crate: glory-routing
path: crates/routing
- crate: glory
path: crates/glory
- crate: glory-cli
path: crates/glory-cli
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Checkout
uses: actions/checkout@v4

- name: Get releasing version
working-directory: ${{ matrix.package.path }}
run: echo NEXT_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV

- name: Check published version
run: echo PREV_VERSION=$(cargo search ${{ matrix.package.crate }} --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV

- name: Cargo login
if: env.NEXT_VERSION != env.PREV_VERSION
run: cargo login ${{ secrets.CRATES_TOKEN }}

- name: Cargo package
if: env.NEXT_VERSION != env.PREV_VERSION
working-directory: ${{ matrix.package.path }}
run: |
echo "Releasing version: $NEXT_VERSION"
echo "Published version: $PREV_VERSION"
echo "Cargo Packaging..."
cargo package
- name: Publish ${{ matrix.package.name }}
if: env.NEXT_VERSION != env.PREV_VERSION
working-directory: ${{ matrix.package.path }}
run: |
echo "Cargo Publishing..."
cargo publish --no-verify
echo "New version $NEXT_VERSION has been published"
4 changes: 1 addition & 3 deletions crates/core/src/web/events/ssr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ impl<E: 'static> EventDescriptor for Custom<E> {
}

impl<E> Custom<E> {
/// Creates a custom event type that can be used within
/// [`HtmlElement::on`](crate::HtmlElement::on), for events
/// which are not covered in the [`ev`](crate::ev) module.
/// Creates a custom event type.
pub fn new(name: impl Into<Cow<'static, str>>) -> Self {
Self {
name: name.into(),
Expand Down

0 comments on commit 6f99be5

Please sign in to comment.