Add usage docs #67
Workflow file for this run
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
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- master | |
tags: | |
- v?[0-9]+.[0-9]+.[0-9]+* | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Build the NixOS configuration for EtherCalc and push it to FlakeHub Cache | |
build-publish: | |
runs-on: ubuntu-latest | |
outputs: | |
flakeref-exact: ${{ steps.flakehub-push.outputs.flakeref-exact }} | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
# Install Nix | |
- uses: DeterminateSystems/nix-installer-action@main | |
with: | |
flakehub: true | |
# Set up FlakeHub Cache using the Magic Nix Cache | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
# Build the closure, which is automatically pushed to FlakeHub Cache | |
- name: Build NixOS closure | |
run: | | |
nix build .#nixosConfigurations.ethercalc-demo.config.system.build.toplevel | |
# Publish the flake to FlakeHub | |
- uses: DeterminateSystems/flakehub-push@main | |
id: flakehub-push | |
with: | |
name: DeterminateSystems/demo | |
rolling: true | |
visibility: private | |
include-output-paths: true | |
# Deploy the image to AWS | |
deploy: | |
if: github.ref == 'refs/heads/main' | |
needs: build-publish | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-east-2 | |
role-to-assume: arn:aws:iam::194722411868:role/github-actions/FlakeHubDeployDemo | |
- name: Deploy Ethercalc | |
run: | | |
aws ssm send-command \ | |
--region us-east-2 \ | |
--targets Key=tag:Name,Values=FlakeHubDemo \ | |
--document-name "FlakeHub-ApplyNixOS" \ | |
--parameters flakeref="${{ needs.build-publish.outputs.flakeref-exact }}#nixosConfigurations.ethercalc-demo" |