From 6e1ad62f836d2a2132202a4f1a925abc30b2f03e Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sat, 12 Apr 2025 19:31:19 -0400 Subject: [PATCH] Attempt #1 at fixing nix deployment --- .github/workflows/ci-pipeline.yml | 59 ++---------------------- .github/workflows/nix-deployment.yml | 67 ++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/nix-deployment.yml diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 6d26ff98d3..1011e97ac7 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -2330,64 +2330,11 @@ jobs: asset_content_type: application/octet-stream update-nix: - name: Update Nix SHA + name: Nix Deployment needs: changelog-regen - runs-on: ubuntu-latest if: (!(cancelled() || failure())) && needs.changelog-regen.result == 'success' - steps: - - name: Install Native Packages # Name checked in rerunFlakyTests.js - run: | - sudo apt-get update - sudo apt-get install -y xmlstarlet - - - name: Setup Nix - uses: cachix/install-nix-action@v30 - with: - nix_path: nixpkgs=channel:nixos-unstable - - - name: Generate App Token - id: app-token-generation - uses: actions/create-github-app-token@v1 - with: - repositories: tgstation-ppa - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - - - name: Clone - run: git clone -b master --single-branch "https://tgstation-server-ci:${{ steps.app-token-generation.outputs.token }}@github.com/tgstation/tgstation-server" --depth 1 . - - - name: Parse TGS version - run: echo "TGS_VERSION=$(xmlstarlet sel -N X="http://schemas.microsoft.com/developer/msbuild/2003" --template --value-of /X:Project/X:PropertyGroup/X:TgsCoreVersion build/Version.props)" >> $GITHUB_ENV - - - name: Retrieve ServerConsole.zip Artifact - uses: actions/download-artifact@v4 - with: - name: server-console-release - path: server-console-release - - - name: Regenerate Nix Hash - run: | - nix hash path ./server-console-release > build/package/nix/ServerConsole.sha256 - cat build/package/nix/ServerConsole.sha256 - - - name: Commit - run: | - git config --global push.default simple - git config user.name "tgstation-server-ci[bot]" - git config user.email "161980869+tgstation-server-ci[bot]@users.noreply.github.com" - git add build/package/nix/ServerConsole.sha256 - git commit -m "Update nix SHA256 for TGS v${{ env.TGS_VERSION }}" - - - name: Re-tag - run: | - git tag -d tgstation-server-v${{ env.TGS_VERSION }} - git tag -a tgstation-server-v${{ env.TGS_VERSION }} -m tgstation-server-v${{ env.TGS_VERSION }} - - - name: Push Commit - run: git push "https://tgstation-server-ci:${{ steps.app-token-generation.outputs.token }}@github.com/tgstation/tgstation-server" - - - name: Force Push Tags - run: git push -f origin tag tgstation-server-v${{ env.TGS_VERSION }} + uses: ./.github/workflows/nix-deployment.yml + secrets: inherit changelog-regen: name: Regenerate Changelog diff --git a/.github/workflows/nix-deployment.yml b/.github/workflows/nix-deployment.yml new file mode 100644 index 0000000000..aaf1a2c4d0 --- /dev/null +++ b/.github/workflows/nix-deployment.yml @@ -0,0 +1,67 @@ +name: Nix Deployment + +on: + workflow_call: + workflow_dispatch: + +jobs: + update-nix: + name: Update Nix SHA (master) + runs-on: ubuntu-latest + steps: + - name: Install Native Packages # Name checked in rerunFlakyTests.js + run: | + sudo apt-get update + sudo apt-get install -y xmlstarlet + + - name: Setup Nix + uses: cachix/install-nix-action@v30 + with: + nix_path: nixpkgs=channel:nixos-unstable + + - name: Generate App Token + id: app-token-generation + uses: actions/create-github-app-token@v1 + with: + repositories: tgstation-ppa + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token-generation.outputs.token }} + ref: master + + - name: Parse TGS version + run: echo "TGS_VERSION=$(xmlstarlet sel -N X="http://schemas.microsoft.com/developer/msbuild/2003" --template --value-of /X:Project/X:PropertyGroup/X:TgsCoreVersion build/Version.props)" >> $GITHUB_ENV + + - name: Retrieve ServerConsole.zip Artifact + run: | + curl -L https://github.com/tgstation/tgstation-server/releases/download/tgstation-server-v${{ env.TGS_VERSION }}/ServerConsole.zip -f -o ServerConsole.zip + unzip ServerConsole.zip -d release + + - name: Regenerate Nix Hash + run: | + nix hash path ./release > build/package/nix/ServerConsole.sha256 + cat build/package/nix/ServerConsole.sha256 + rm -rf ./release ServerConsole.zip + + - name: Commit + run: | + git config --global push.default simple + git config user.name "tgstation-server-ci[bot]" + git config user.email "161980869+tgstation-server-ci[bot]@users.noreply.github.com" + git add build/package/nix/ServerConsole.sha256 + git commit -m "Update nix SHA256 for TGS v${{ env.TGS_VERSION }}" + + - name: Re-tag + run: | + git tag -d tgstation-server-v${{ env.TGS_VERSION }} + git tag -a tgstation-server-v${{ env.TGS_VERSION }} -m tgstation-server-v${{ env.TGS_VERSION }} + + - name: Push Commit + run: git push "https://tgstation-server-ci:${{ steps.app-token-generation.outputs.token }}@github.com/tgstation/tgstation-server" + + - name: Force Push Tags + run: git push -f origin tag tgstation-server-v${{ env.TGS_VERSION }}