diff --git a/.github/workflows/flake.yaml b/.github/workflows/flake.yaml index 7e4bdc9..09f7ee5 100644 --- a/.github/workflows/flake.yaml +++ b/.github/workflows/flake.yaml @@ -7,11 +7,30 @@ on: - main jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: DeterminateSystems/nix-installer-action@main + - uses: cachix/cachix-action@v12 + with: + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + name: altf4llc-os + - uses: actions/checkout@v3 + - run: cachix use altf4llc-os + - run: nix develop -c just check + - run: nix develop -c just cache-inputs + - run: nix develop -c just cache-shell + build: + needs: + - check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v4 - - uses: DeterminateSystems/magic-nix-cache-action@v2 - - run: nix flake check - - run: nix build --json --no-link --print-build-logs + - uses: DeterminateSystems/nix-installer-action@main + - uses: cachix/cachix-action@v12 + with: + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + name: altf4llc-os + - uses: actions/checkout@v4 + - run: cachix use altf4llc-os + - run: nix develop -c just cache-build diff --git a/README.md b/README.md index a0ae98a..f3b1054 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ Terraform module which creates GitHub team resources. | Name | Version | |------|---------| -| [github](#requirement\_github) | 5.41.0 | +| [github](#requirement\_github) | 6.0.0 | ## Providers | Name | Version | |------|---------| -| [github](#provider\_github) | 5.41.0 | +| [github](#provider\_github) | 6.0.0 | ## Modules @@ -22,8 +22,8 @@ No modules. | Name | Type | |------|------| -| [github_team.self](https://registry.terraform.io/providers/integrations/github/5.41.0/docs/resources/team) | resource | -| [github_team_membership.self](https://registry.terraform.io/providers/integrations/github/5.41.0/docs/resources/team_membership) | resource | +| [github_team.self](https://registry.terraform.io/providers/integrations/github/6.0.0/docs/resources/team) | resource | +| [github_team_membership.self](https://registry.terraform.io/providers/integrations/github/6.0.0/docs/resources/team_membership) | resource | ## Inputs diff --git a/flake.lock b/flake.lock index ff14bbe..7f8bc00 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1698882062, - "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", "type": "github" }, "original": { @@ -19,11 +19,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1698924604, - "narHash": "sha256-GCFbkl2tj8fEZBZCw3Tc0AkGo0v+YrQlohhEGJ/X4s0=", + "lastModified": 1708984720, + "narHash": "sha256-gJctErLbXx4QZBBbGp78PxtOOzsDaQ+yw1ylNQBuSUY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fa804edfb7869c9fb230e174182a8a1a7e512c40", + "rev": "13aff9b34cc32e59d35c62ac9356e4a41198a538", "type": "github" }, "original": { @@ -36,11 +36,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1698611440, - "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 51eddd8..214e08b 100644 --- a/flake.nix +++ b/flake.nix @@ -3,51 +3,61 @@ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - outputs = inputs@{ flake-parts, nixpkgs, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; - perSystem = { config, self', inputs', pkgs, system, ... }: - let - terraform-github = pkgs.terraform-providers.mkProvider { + outputs = inputs @ { + flake-parts, + nixpkgs, + ... + }: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = ["x86_64-linux" "aarch64-darwin" "x86_64-darwin"]; + perSystem = { + config, + self', + inputs', + pkgs, + system, + ... + }: let + inherit (pkgs) just terraform-docs; + terraform = pkgs.terraform.withPlugins (p: [ + (pkgs.terraform-providers.mkProvider { + hash = "sha256-y8DMpNSySMbe7E+sGVQcQdEyulq4Wnp5ryYD7FQO/fc="; homepage = "https://registry.terraform.io/providers/integrations/github"; owner = "integrations"; repo = "terraform-provider-github"; - rev = "v5.41.0"; - hash = "sha256-fWxWcHy3TWFEpkU9uDSsHbUu+dnQKfvquN63eZH+Qf0="; + rev = "v6.0.0"; vendorHash = null; - }; - in - { - _module.args.pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - }; + }) + ]); + in { + _module.args.pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; - packages = { - terraform-with-plugins = pkgs.terraform.withPlugins (ps: [ - terraform-github - ]); + devShells = { + default = pkgs.mkShell { + buildInputs = [ + just + terraform + terraform-docs + ]; + }; + }; - default = pkgs.runCommand "default" - { - src = ./.; - } '' + packages = { + default = + pkgs.runCommand "default" + { + src = ./.; + } '' mkdir -p $out cp -R $src/*.tf $out - ${config.packages.terraform-with-plugins}/bin/terraform -chdir="$out" init - ${config.packages.terraform-with-plugins}/bin/terraform -chdir="$out" validate + ${terraform}/bin/terraform -chdir="$out" init + ${terraform}/bin/terraform -chdir="$out" validate ''; - }; - - devShells = { - default = pkgs.mkShell { - buildInputs = with pkgs; [ - terraform - terraform-docs - ]; - }; - }; }; + }; }; } diff --git a/justfile b/justfile new file mode 100644 index 0000000..fd671ea --- /dev/null +++ b/justfile @@ -0,0 +1,33 @@ +_default: + just --list + +build: + nix build --json --no-link --print-build-logs + +cache-build cache_name="altf4llc-os": + just build \ + | jq -r '.[].outputs | to_entries[].value' \ + | cachix push {{ cache_name }} + +cache-inputs cache_name="altf4llc-os": + nix flake archive --json \ + | jq -r '.path,(.inputs|to_entries[].value.path)' \ + | cachix push "{{ cache_name }}" + +cache-shell cache_name="altf4llc-os": + nix develop --profile "dev-profile" -c true + cachix push "{{ cache_name }}" "dev-profile" + +check: + nix flake check + +docs: + terraform-docs markdown table \ + --output-file README.md \ + --output-mode inject . + +init: + terraform init + +validate: + terraform validate diff --git a/providers.tf b/versions.tf similarity index 80% rename from providers.tf rename to versions.tf index e75b74d..02fee5d 100644 --- a/providers.tf +++ b/versions.tf @@ -2,7 +2,7 @@ terraform { required_providers { github = { source = "integrations/github" - version = "5.41.0" + version = "6.0.0" } } }