Skip to content

Commit

Permalink
Merge pull request #118 from mobusoperandi/semantic-release
Browse files Browse the repository at this point in the history
build: release-please -> semantic-release
  • Loading branch information
mightyiam authored Jun 29, 2024
2 parents 1a2a18c + 5270d4d commit cd5e0b7
Show file tree
Hide file tree
Showing 8 changed files with 6,921 additions and 13 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ on:
push:
branches: [main]
pull_request:
workflow_call:

jobs:
test:
Expand Down Expand Up @@ -33,16 +34,3 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: fmt
run: nix develop --command cargo fmt --check

release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
permissions:
pull-requests: write
contents: write
needs: [test, clippy, fmt]
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: rust
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
branches: [main]

jobs:
check:
uses: ./.github/workflows/check.yaml

release:
needs: [check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: navikt/github-app-token-generator@v1
id: get-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- run: nix run .#release
env:
GITHUB_TOKEN: ${{ steps.get-token.outputs.token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/release/semantic-release-with-plugins/node_modules
17 changes: 17 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
branches:
- main
plugins:
- - "@semantic-release/commit-analyzer"
- preset: conventionalcommits
- - "@semantic-release/release-notes-generator"
- preset: conventionalcommits
- "@semantic-release/changelog"
- "@semantic-release/github"
- - "@semantic-release/exec"
- verifyConditionsCmd: bump-version --dry-run 999.0.0
prepareCmd: bump-version ${nextRelease.version}
- - "@semantic-release/git"
- assets:
- CHANGELOG.md
- Cargo.lock
- Cargo.toml
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@
}
);

apps = import ./release {inherit pkgs flake-utils;};

devShells.default = craneLib.devShell {
inherit NIX_CMD_PATH NIX_INSTANTIATE_CMD_PATH;
inputsFrom = [self.packages.${system}.default];
packages = [
toolchain
pkgs.nodePackages.nodejs
pkgs.mob
];
};
Expand Down
33 changes: 33 additions & 0 deletions release/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
pkgs,
flake-utils,
}: let
inherit (pkgs) buildNpmPackage cargo-edit writeShellApplication;

semantic-release = buildNpmPackage {
pname = "semantic-release-with-plugins";
version = "1.0.0";
src = ./semantic-release-with-plugins;
npmDepsHash = "sha256-IRIXLSmB9yOnvBrxDkU2tJa+7LUquQRBt4YQ+TyKXK8=";
dontNpmBuild = true;
};

bump-version = writeShellApplication {
name = "bump-version";
runtimeInputs = [cargo-edit];
text = ''
cargo set-version "$@"
'';
};

release = writeShellApplication {
name = "release-pr-tracker";
runtimeInputs = [bump-version];
text = ''
${semantic-release}/bin/semantic-release "$@"
'';
};
in {
bump-version = flake-utils.lib.mkApp {drv = bump-version;};
release = flake-utils.lib.mkApp {drv = release;};
}
Loading

0 comments on commit cd5e0b7

Please sign in to comment.