diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index a06e467..09cdb1d 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -3,25 +3,39 @@ name: Build sourcepawn and commit on: push: paths: - - '**.sp' + - "**.sp" + - ".forgejo/workflows/**" jobs: build: - runs-on: ubuntu-latest + runs-on: nix steps: - - uses: actions/checkout@v4 - - name: Compile sourcepawn - uses: spiretf/spcomp@v0.1 + - uses: actions/checkout@v6 + - uses: https://codeberg.org/icewind/attic-action@v1 with: - source: './plugin/nochat.sp' - target: './plugin/nochat.smx' + name: link + instance: https://cache.icewind.link + authToken: "${{ secrets.ATTIC_TOKEN }}" + + - name: Build + run: nix build && cp -L result/* ./plugin/ + + - id: check_file_outdated + name: Check if compiled smx needs committing + run: | + git status --porcelain + if [ -n "$(git status --porcelain)" ]; then + echo "compiled output has changed" + echo "outdated=true" >> $GITHUB_OUTPUT + else + echo "compiled output has unchanged" + echo "outdated=false" >> $GITHUB_OUTPUT + fi - name: Commit files + if: steps.check_file_outdated.outputs.outdated == 'true' run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" + git config --global user.email "" + git config --global user.name "Compile from CI" git commit -m "Compile sourcepawn" -a - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + git push diff --git a/flake.lock b/flake.lock index 8878d01..59b80b9 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1759818365, - "narHash": "sha256-N8jwqZ9T1ZBznv4gJ6aaHV3FZiYyErbIqeY3cxNQ07E=", + "lastModified": 1793039426, + "narHash": "sha256-h1ltnuVmtdXZAruOMxMVfiacB43PA/Srwrr4+iuWNuo=", "owner": "nix-community", "repo": "flakelight", - "rev": "eda172d7ead89292cb7f9e136a482e97e00873a4", + "rev": "b3da3d82a9f10f306551eb586cce0e49428b1d8f", "type": "github" }, "original": { @@ -22,16 +22,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1760048741, - "narHash": "sha256-Jj+2qvTpPwU+KD2y2QSiqg4J3vsA3as6YsPl/s/6EzQ=", + "lastModified": 1793015021, + "narHash": "sha256-Ee5BWo8sh3pGt70QUdRajnaginqFmWvrtdBc4gJzhks=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "86aeb8a48968515e7e5625252e79137ccee0af8f", + "rev": "718f670e845328e9c2cecdd832835712b2cbd065", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "release-25.05", + "ref": "nixos-26.05", "type": "indirect" } }, @@ -39,60 +39,51 @@ "inputs": { "flakelight": "flakelight", "nixpkgs": "nixpkgs", - "spire": "spire", - "utils": "utils" + "spire": "spire" } }, "spire": { "inputs": { "flakelight": [ "flakelight" + ], + "nixpkgs": [ + "nixpkgs" + ], + "steam-fetcher": "steam-fetcher" + }, + "locked": { + "lastModified": 1793221599, + "narHash": "sha256-0RdekqEwbNuR0ve/jEEwh6QQvQXfaSRRofL0E65+Y/A=", + "ref": "refs/heads/main", + "rev": "520cf4e47ef47efec3f1ba2341ab0f7af68cd477", + "revCount": 99, + "type": "git", + "url": "https://codeberg.org/spire/nix" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/spire/nix" + } + }, + "steam-fetcher": { + "inputs": { + "nixpkgs": [ + "spire", + "nixpkgs" ] }, "locked": { - "lastModified": 1750433696, - "narHash": "sha256-UVtSgRUzgHKUWcjsVQQM/6J8x35ly/7+P9/xbXeGLtc=", - "ref": "refs/heads/main", - "rev": "f3b763c6b9c0c31924ac2ba1b6541c2b08ed9852", - "revCount": 33, - "type": "git", - "url": "https://codeberg.org/spire/nix" - }, - "original": { - "type": "git", - "url": "https://codeberg.org/spire/nix" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1758622040, + "narHash": "sha256-BRUZZoQDCD1qByJjHm4YKipQlB2PburWLG9Iaggr8XQ=", + "owner": "nix-community", + "repo": "steam-fetcher", + "rev": "ab5e3a0828b4b179feb548c57be584ce812956a8", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "nix-community", + "repo": "steam-fetcher", "type": "github" } } diff --git a/flake.nix b/flake.nix index 32d7871..bdd6526 100644 --- a/flake.nix +++ b/flake.nix @@ -1,36 +1,18 @@ { inputs = { - utils.url = "github:numtide/flake-utils"; - nixpkgs.url = "nixpkgs/release-25.05"; - flakelight.url = "github:nix-community/flakelight"; - spire.url = "git+https://codeberg.org/spire/nix"; - flakelight.inputs.nixpkgs.follows = "nixpkgs"; - spire.inputs.flakelight.follows = "flakelight"; + nixpkgs.url = "nixpkgs/nixos-26.05"; + flakelight = { + url = "github:nix-community/flakelight"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + spire = { + url = "git+https://codeberg.org/spire/nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flakelight.follows = "flakelight"; + }; }; - outputs = { - self, - nixpkgs, - utils, - spire, - ... - }: - utils.lib.eachSystem ["x86_64-linux" "i686-linux"] (system: let - overlays = [spire.overlays.default]; - pkgs = (import nixpkgs) { - inherit system overlays; - }; - spEnv = pkgs.sourcepawn.buildEnv (with pkgs.sourcepawn.includes; [sourcemod]); - in rec { - packages = rec { - nochat = pkgs.buildSourcePawnScript { - name = "nochat"; - src = ./plugin/nochat.sp; - }; - default = nochat; - }; - devShells.default = pkgs.mkShell { - nativeBuildInputs = with pkgs; [spEnv]; - }; - }); + outputs = + { spire, ... }: + spire ./. { }; }