Skip to content

Commit

Permalink
ci: add automatic deploys to testnet environment
Browse files Browse the repository at this point in the history
Now that we've resolved #73, we're unblocked from restoring rolling
deployments on merge to main, to the testnet instance [0].
This new workflow blocks on completion of the build-container logic,
then bounces the pre-existing deployment to pull the most recently built
container.

Refs #72.

[0] https://dex-explorer.testnet.plinfra.net
  • Loading branch information
conorsch committed Oct 9, 2024
1 parent df94a11 commit d297dd8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
# Workflow for deploying the DEX explorer webapp https://github.com/penumbra-zone/dex-explorer
# Bounces a container deployment, to repull the latest image.
name: deploy dex-explorer
on:
workflow_dispatch:
push:
branches:
- main

jobs:
build-container:
name: build container
uses: ./.github/workflows/container.yml
secrets: inherit
permissions:
contents: read
packages: write

deploy-testnet:
name: deploy dex-explorer to testnet
env:
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
needs:
- build-container
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4

- name: install nix
uses: nixbuild/nix-quick-install-action@v28

- name: setup nix cache
uses: nix-community/cache-nix-action@v5
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
backend: buildjet

# Confirm that the nix devshell is buildable and runs at all.
- name: validate nix env
run: nix develop --command echo hello

- name: save DigitalOcean kubeconfig with short-lived credentials
run: >
nix develop --command
doctl kubernetes cluster kubeconfig save --expiry-seconds 600 plinfra
# We assume that dex-explorer has been deployed to the cluster already.
# This task merely "bounces" the service, so that a fresh container is pulled.
- name: deploy dex-explorer
run: >
nix develop --command
kubectl rollout restart deployment dex-explorer-testnet
kubectl rollout status deployment dex-explorer-testnet
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
just
pnpm
postgresql

# for deployment/ci
doctl
kubectl
];
};
});
Expand Down

0 comments on commit d297dd8

Please sign in to comment.