diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..be4e140 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release + +on: + push: + branches: [main] + +permissions: + contents: write + pull-requests: write + id-token: write + +jobs: + release: + name: Release + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: true + + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0 + + - name: Authenticate with crates.io + uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5 + id: auth + + - name: release-plz + uses: MarcoIeni/release-plz-action@b8d6b54b02889ff2ae2bb82e8b57c3a8fc1683a5 # v0.5.139 + id: release-plz + env: + GITHUB_TOKEN: ${{ github.token }} + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} + + - name: Install Nix + if: ${{ steps.release-plz.outputs.prs_created == 'true' || steps.release-plz.outputs.releases_created == 'true' }} + uses: nixbuild/nix-quick-install-action@9f63be77f412a248c9d9a65a4c82cf066cdf8f0c # v35 + + - name: Enter Nix devshell + if: ${{ steps.release-plz.outputs.prs_created == 'true' || steps.release-plz.outputs.releases_created == 'true' }} + uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1.2.1 + with: + arguments: .#ci-release + + - name: Bump changelog versions + if: ${{ steps.release-plz.outputs.prs_created == 'true' }} + env: + GH_TOKEN: ${{ github.token }} + RELEASE_PLZ_PR_JSON: ${{ steps.release-plz.outputs.pr }} + run: x52-bump-changelogs + + - name: Update release notes + if: ${{ steps.release-plz.outputs.releases_created == 'true' }} + env: + GH_TOKEN: ${{ github.token }} + RELEASE_PLZ_RELEASES_JSON: ${{ steps.release-plz.outputs.releases }} + run: x52-update-release-notes --then-undraft diff --git a/.release-plz.toml b/.release-plz.toml new file mode 100644 index 0000000..404923c --- /dev/null +++ b/.release-plz.toml @@ -0,0 +1,9 @@ +[workspace] +changelog_update = false +dependencies_update = false +pr_draft = true +git_release_draft = true +pr_labels = ["release"] +publish_all_features = true +git_tag_name = "{{ package }}-v{{ version }}" +git_release_name = "{{ package }}: v{{ version }}" diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c9e65eb --- /dev/null +++ b/flake.lock @@ -0,0 +1,85 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1790898470, + "narHash": "sha256-zTwuwezD0w3hpga6a6P8emidzAZFyWqlNeRBlpWOOl8=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "024633cd702b10285db5cb19b40ad48d2399ba60", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1791426274, + "narHash": "sha256-MWhktfFtFE8Jl7bf9Pkp7TR5MSdYCjCswSo0Gkb4ywc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7c8764b7c7b09b34f632464276218ef9090eaa11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-26.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1790477367, + "narHash": "sha256-oujbxmVKDhci2E4EM3KyAbRUgp5/IsCoiA/LfEF7OOk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f7cd230690d9fc982d06129f9189b101fddcfa3b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "x52": "x52" + } + }, + "x52": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1791501778, + "narHash": "sha256-2HLxyAtbHUiTuVx4KCC4SIRZdcgnfpIjfOtjWULRN8o=", + "owner": "x52dev", + "repo": "nix", + "rev": "cb0c45f9c706bd8b3f65dabb6a4e860d7afded8e", + "type": "github" + }, + "original": { + "owner": "x52dev", + "repo": "nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ae0eae4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,22 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05"; + flake-parts.url = "github:hercules-ci/flake-parts"; + x52 = { + url = "github:x52dev/nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-parts.follows = "flake-parts"; + }; + }; + + outputs = inputs @ { flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + + perSystem = { pkgs, inputs', ... }: { + devShells.ci-release = pkgs.mkShell { + packages = [ inputs'.x52.packages.x52-release-tools ]; + }; + }; + }; +}