Deploy #824
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
workflow_run: | |
workflows: | |
- Nix | |
branches: | |
- main | |
types: | |
- completed | |
workflow_dispatch: | |
concurrency: deploy | |
jobs: | |
deploy: | |
name: Build and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free up runner space | |
run: | | |
# large docker images | |
sudo docker image prune --all --force | |
# large packages | |
sudo apt-get purge -y '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*' azure-cli google-cloud-cli google-chrome-stable firefox powershell microsoft-edge-stable | |
sudo apt-get autoremove -y | |
sudo apt-get clean | |
# large folders | |
sudo rm -rf /var/lib/apt/lists/* /opt/hostedtoolcache /usr/local/games /usr/local/sqlpackage /usr/local/.ghcup /usr/local/share/powershell /usr/local/share/edge_driver /usr/local/share/gecko_driver /usr/local/share/chromium /usr/local/share/chromedriver-linux64 /usr/local/share/vcpkg /usr/local/lib/python* /usr/local/lib/node_modules /usr/local/julia* /opt/mssql-tools /etc/skel /usr/share/vim /usr/share/postgresql /usr/share/man /usr/share/apache-maven-* /usr/share/R /usr/share/alsa /usr/share/miniconda /usr/share/grub /usr/share/gradle-* /usr/share/locale /usr/share/texinfo /usr/share/kotlinc /usr/share/swift /usr/share/doc /usr/share/az_9.3.0 /usr/share/sbt /usr/share/ri /usr/share/icons /usr/share/java /usr/share/fonts /usr/lib/google-cloud-sdk /usr/lib/jvm /usr/lib/mono /usr/lib/R /usr/lib/postgresql /usr/lib/heroku /usr/lib/gcc | |
- uses: DeterminateSystems/nix-installer-action@v15 | |
with: | |
diagnostic-endpoint: '' | |
source-url: 'https://install.lix.systems/lix/lix-installer-x86_64-linux' | |
- uses: cachix/cachix-action@v15 | |
with: | |
name: foosteros | |
extraPullNames: cosmic | |
- uses: actions/checkout@v4 | |
- id: build | |
name: Build hosts | |
run: | | |
nix -vL --show-trace build .#deploy | |
echo "spec=$(nix -vL --show-trace eval --raw .#deploy)" >> $GITHUB_OUTPUT | |
- name: Deploy hosts | |
env: | |
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
CACHIX_ACTIVATE_TOKEN: ${{ secrets.CACHIX_ACTIVATE_TOKEN }} | |
SPEC: ${{ steps.build.outputs.spec }} | |
run: | | |
cachix push foosteros "$SPEC" | |
cachix deploy activate "$SPEC" |