From 85a93ac790a89bf7d9835089b2198260e97df1e2 Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Sat, 9 Jul 2022 19:48:10 +0200 Subject: [PATCH] ci: add semantic-release --- .github/workflows/{rust.yml => release.yml} | 30 ++++++++++----------- .releaserc | 27 +++++++++++++++++++ 2 files changed, 42 insertions(+), 15 deletions(-) rename .github/workflows/{rust.yml => release.yml} (62%) create mode 100644 .releaserc diff --git a/.github/workflows/rust.yml b/.github/workflows/release.yml similarity index 62% rename from .github/workflows/rust.yml rename to .github/workflows/release.yml index 6cc9657..a023283 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/release.yml @@ -1,25 +1,14 @@ -name: Rust +name: Release on: push: - branches: - - main - - pull_request: - - workflow_dispatch: + branches: [main, dev] env: CARGO_TERM_COLOR: always jobs: build: - strategy: - fail-fast: false - matrix: - rust: [stable, nightly] - - name: ${{ matrix.rust }} runs-on: ubuntu-latest steps: @@ -31,10 +20,15 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: ${{ matrix.rust }} + toolchain: stable override: true components: clippy + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: "lts/*" + - name: Cache uses: actions/cache@v3 id: cache @@ -42,7 +36,7 @@ jobs: path: | ~/.cargo/registry/cache/ target/ - key: ${{ matrix.rust }}-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + key: ${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - name: cargo build uses: actions-rs/cargo@v1 @@ -54,3 +48,9 @@ jobs: with: command: clippy args: --no-deps -- -D warnings + + - name: Setup semantic-release + run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog -D + + - name: Release + run: npx semantic-release diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..5511cc5 --- /dev/null +++ b/.releaserc @@ -0,0 +1,27 @@ +{ + "branches": [{ + "name": "dev", + "prerelease": true + }, "main"], + "plugins": [ + ["@semantic-release/commit-analyzer", { + "releaseRules": [{ + "type": "build", + "release": "patch" + }] + }], + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + ["@semantic-release/git", { + "assets": [ + "CHANGELOG.md", + "gradle.properties" + ] + }], + ["@semantic-release/github", { + "assets": [{ + "path": "target/release/revanced-discord-bot" + }] + }] + ] +} \ No newline at end of file