diff --git a/.forgejo/workflows/compile.yaml b/.forgejo/workflows/compile.yaml new file mode 100644 index 0000000..b1f2a3f --- /dev/null +++ b/.forgejo/workflows/compile.yaml @@ -0,0 +1,42 @@ +name: Build sourcepawn and commit + +on: + push: + paths: + - '**.sp' + +jobs: + build: + runs-on: nix + env: + PLUGIN: "autoexec" + steps: + - uses: actions/checkout@v4 + - id: check_file_outdated + name: Check if ${{ env.PLUGIN }}.smx is outdated + run: | + if [ ./plugin/${{ env.PLUGIN }}.sp -nt ./plugin/${{ env.PLUGIN }}.smx ]; then + echo "${{ env.PLUGIN }}.smx is up to date" + echo "outdated=false" >> $GITHUB_OUTPUT + else + echo "${{ env.PLUGIN }}.smx is outdated" + echo "outdated=true" >> $GITHUB_OUTPUT + fi + - uses: https://codeberg.org/icewind/attic-action@v1 + if: steps.check_file_outdated.outputs.outdated == 'true' + with: + name: link + instance: https://cache.icewind.link + authToken: "${{ secrets.ATTIC_TOKEN }}" + + - name: Build + if: steps.check_file_outdated.outputs.outdated == 'true' + run: nix build && cp -L result ./plugin/${{ env.PLUGIN }}.smx + + - name: Commit files + if: steps.check_file_outdated.outputs.outdated == 'true' + run: | + git config --global user.email "" + git config --global user.name "Compile from CI" + git commit -m "Compile sourcepawn" -a + git push diff --git a/.github/workflows/compile.yaml b/.github/workflows/compile.yaml deleted file mode 100644 index 93298a4..0000000 --- a/.github/workflows/compile.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build sourcepawn and commit - -on: - push: - paths: - - '**.sp' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Compile sourcepawn - uses: spiretf/spcomp@v0.1.0 - with: - source: './plugin/autoexec.sp' - target: './plugin/autoexec.smx' - - - name: Commit files - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -m "Compile sourcepawn" -a - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/flake.nix b/flake.nix index c75b8cc..faaa3ee 100644 --- a/flake.nix +++ b/flake.nix @@ -22,11 +22,11 @@ spEnv = pkgs.sourcepawn.buildEnv (with pkgs.sourcepawn.includes; [sourcemod]); in { packages = rec { - nochat = pkgs.buildSourcePawnScript { + autoexec = pkgs.buildSourcePawnScript { name = "autoexec"; src = ./plugin/autoexec.sp; }; - default = nochat; + default = autoexec; }; devShells.default = pkgs.mkShell { nativeBuildInputs = [spEnv]; diff --git a/plugin/autoexec.smx b/plugin/autoexec.smx index 4476fec..de92909 100644 Binary files a/plugin/autoexec.smx and b/plugin/autoexec.smx differ