name: "CI" on: pull_request: push: jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v22 - uses: cachix/cachix-action@v12 with: name: devenv - uses: cachix/cachix-action@v12 with: name: alejandr0angul0-dev authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - name: Run pre-commit hooks run: | git fetch origin nix develop --accept-flake-config --impure --command bash -c \ "pre-commit run --from-ref origin/main --to-ref $GITHUB_SHA" build: needs: [lint] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v22 - uses: cachix/cachix-action@v12 with: name: devenv - uses: cachix/cachix-action@v12 with: name: alejandr0angul0-dev authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - run: nix build --accept-flake-config -L deploy: needs: [build] runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' env: PROD_DEPLOY_CONFIG_PATH: config/production/deployment.toml steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v22 - uses: cachix/cachix-action@v12 with: name: devenv - uses: cachix/cachix-action@v12 with: name: alejandr0angul0-dev authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - name: Deploy run: | sed 's~{{S3URL}}~${{ secrets.S3URL }}~g' "${PROD_DEPLOY_CONFIG_PATH}.sample" > "${PROD_DEPLOY_CONFIG_PATH}" sed -i 's~{{CLOUDFRONTDISTRIBUTIONID}}~${{ secrets.CLOUDFRONTDISTRIBUTIONID }}~g' "${PROD_DEPLOY_CONFIG_PATH}" nix develop --accept-flake-config --impure --command bash \ -c env AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \ AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ AWS_DEFAULT_REGION=${{ secrets.AWS_DEFAULT_REGION }} \ HUGO_ENV=production \ hugo deploy --invalidateCDN