site_updated #29
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
# This is a basic workflow to help you get started with Actions | |
name: Deploy website & server | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
repository_dispatch: | |
push: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
TF_VAR_ACCOUNT_JSON: ${{ secrets.TF_VAR_ACCOUNT_JSON }} | |
TF_VAR_INSTANCE_SSH_KEY: ${{ secrets.TF_VAR_INSTANCE_SSH_KEY }} | |
TF_VAR_ROBBINS_PAGE_PEM: ${{ secrets.TF_VAR_ROBBINS_PAGE_PEM }} | |
TF_VAR_ROBBINS_PAGE_KEY: ${{ secrets.TF_VAR_ROBBINS_PAGE_KEY }} | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build-deploy" | |
build-deploy: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Install Nix | |
# You may pin to the exact commit or the version. | |
# uses: cachix/install-nix-action@daddc62a2e67d1decb56e028c9fa68344b9b7c2a | |
uses: cachix/install-nix-action@v18 | |
with: | |
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/0c9aadc8eff6daaa5149d2df9e6c49baaf44161c.tar.gz | |
extra_nix_config: "system-features = nixos-test benchmark big-parallel kvm" | |
- name: Update website input | |
if: github.event.action == 'site_updated' | |
run: nix flake lock --update-input website-src | |
- name: HashiCorp - Setup Terraform | |
# You may pin to the exact commit or the version. | |
# uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 | |
uses: hashicorp/[email protected] | |
with: | |
# The API token for a Terraform Cloud/Enterprise instance to place within the credentials block of the Terraform CLI configuration file. | |
cli_config_credentials_token: ${{ secrets.TF_USER_API_TOKEN }} | |
terraform_version: 1.3.6 | |
- name: Terraform init | |
id: init | |
run: terraform init | |
- name: Terraform Apply | |
run: terraform apply -auto-approve -input=false | |
- name: Push updated flake.lock | |
if: github.event.action == 'site_updated' | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git push |