diff --git a/.github/workflows/lifecycle.yaml b/.github/workflows/lifecycle.yaml new file mode 100644 index 000000000..d08d5c599 --- /dev/null +++ b/.github/workflows/lifecycle.yaml @@ -0,0 +1,42 @@ +--- +name: Scheduled infrastructure management +on: + schedule: + - cron: '0 13 * * 1,2,3,4,5' # launch at 8:00 AM EST + - cron: '0 23 * * 1,2,3,4,5' # teardown at 6:00 PM EST +jobs: + launch: + if: github.event.schedule == '0 13 * * 1,2,3,4,5' + runs-on: ubuntu-latest + environment: pulumi + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Flox + uses: flox/install-flox-action@v2 + - name: Deploy with Pulumi + uses: flox/activate-action@v1 + env: + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} + with: + command: | + cd infrastructure + uv run pulumi up --yes + nu ping.nu + teardown: + if: github.event.schedule == '0 23 * * 1,2,3,4,5' + runs-on: ubuntu-latest + environment: pulumi + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Flox + uses: flox/install-flox-action@v2 + - name: Dismantle with Pulumi + uses: flox/activate-action@v1 + env: + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} + with: + command: | + cd infrastructure + uv run pulumi down --yes