run seed scripts with bash #61
This file contains hidden or 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: Build NixOS Image | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-image: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v27 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Install tooling | |
| run: | | |
| nix profile install \ | |
| nixpkgs#nixos-generators \ | |
| nixpkgs#awscli2 | |
| - name: Write agenix image key | |
| env: | |
| CLAWDINATOR_AGE_KEY: ${{ secrets.CLAWDINATOR_AGE_KEY }} | |
| run: | | |
| mkdir -p nix/keys | |
| printf '%s' "${CLAWDINATOR_AGE_KEY}" > nix/keys/clawdinator.agekey | |
| chmod 600 nix/keys/clawdinator.agekey | |
| - name: Build image | |
| run: scripts/build-image.sh | |
| - name: Upload image to S3 | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: ${{ secrets.AWS_REGION }} | |
| S3_BUCKET: ${{ secrets.S3_BUCKET }} | |
| run: | | |
| key="$(scripts/upload-image.sh)" | |
| echo "S3_KEY=${key}" >> "${GITHUB_ENV}" | |
| - name: Import image into AMI | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: ${{ secrets.AWS_REGION }} | |
| S3_BUCKET: ${{ secrets.S3_BUCKET }} | |
| S3_KEY: ${{ env.S3_KEY }} | |
| AMI_DESCRIPTION: clawdinator-nixos | |
| run: | | |
| ami_id="$(scripts/import-image.sh)" | |
| echo "AMI_ID=${ami_id}" >> "${GITHUB_ENV}" |