Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: release-please -> semantic-release #118

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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