Skip to content

Github Server

Github Server #100

Workflow file for this run

name: Github Server
on:
workflow_dispatch:
inputs:
os:
description: 'Operating System'
required: true
default: 'ubuntu-latest'
type: choice
options:
- ubuntu-latest
- macos-latest
- ubuntu-24.04-arm
jobs:
CI:
runs-on: ${{ inputs.os }}
steps:
- run: |
mkdir -m 0755 -p ~/.ssh
curl -s "https://api.github.com/users/mlyxshi/keys" | jq .[0].key -r > ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
# macOS ~/.ssh/config
cat > ~/.ssh/ssh_config <<EOF
Host github.com
User git
IdentityFile ~/.ssh/id_ed25519
EOF
- uses: actions/checkout@master
- uses: DeterminateSystems/nix-installer-action@main
# ssh
- run: |
if [ ${{ inputs.os }} == "ubuntu-latest" ]; then
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared.deb
else
brew install cloudflared
sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.before-nix-darwin
nix run --extra-experimental-features "nix-command flakes" nix-darwin -- switch --flake /Users/runner/work/flake/flake#github-action-darwin
sudo chsh -s /run/current-system/sw/bin/fish runner
fi
cloudflared --no-autoupdate tunnel run --token ${{ secrets.CLOUDFLARED_TUNNEL }} &
# extra settings
# github workflow do not support alias, use symlink instead
- run: |
if [ ${{ inputs.os }} == "ubuntu-latest" ]; then
nix run .#homeConfigurations.github-action.activationPackage
mkdir -p ~/.local/bin/ && ln -s ~/.nix-profile/bin/yazi ~/.local/bin/r
else
echo "macOS"
fi
- run: sleep 7200
# - uses: cachix/cachix-action@v14
# with:
# authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
# name: mlyxshi
# signingKey: ${{ secrets.NIX_STORE_SIGN_PRIVATE }}
# - run: nix build /Users/runner/work/flake/flake#nodestatus-client