Skip to content

Commit

Permalink
Include manuals + pills as post build step (#1225)
Browse files Browse the repository at this point in the history
and remove not used files

---------

Co-authored-by: Thilo Billerbeck <[email protected]>
  • Loading branch information
garbas and thilobillerbeck authored Feb 26, 2024
1 parent 8f645d6 commit 39c8714
Show file tree
Hide file tree
Showing 175 changed files with 1,500 additions and 98,962 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use nix
use flake
53 changes: 24 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,71 @@ on:
workflow_dispatch:
push:
branches:
- main
- preview
- "main"
pull_request:

permissions:
contents: write
pull-requests: write
statuses: write
deployments: write
contents: "write"
pull-requests: "write"
statuses: "write"
deployments: "write"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
group: "${{ github.workflow }}-${{ github.head_ref || github.ref_name }}"
cancel-in-progress: true

jobs:

build:
name: "Build nixos.org"
runs-on: ubuntu-latest
runs-on: "ubuntu-latest"

if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:

- name: "Checking out the repository"
uses: actions/checkout@v4
uses: "actions/checkout@v4"
with:
fetch-depth: 0

- name: "Installing Nix"
uses: cachix/install-nix-action@v23
with:
extra_nix_config: |
experimental-features = nix-command flakes
uses: "cachix/install-nix-action@v23"

- name: "Setup Cachix"
uses: cachix/cachix-action@v12
uses: "cachix/cachix-action@v12"
with:
name: nixos-homepage
name: "nixos-homepage"
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'

- name: "Build"
run: |
nix develop --command npm install
nix develop --command npm run build
nix develop --accept-flake-config --command npm install
nix develop --accept-flake-config --command npm run build
mkdir build
cp -RL ./dist/* ./build/
cp -RL ./netlify.toml ./build/
- name: "Publish to Netlify"
if: github.repository == 'NixOS/nixos-homepage'
uses: nwtgck/[email protected]
if: ${{ github.repository == 'NixOS/nixos-homepage' }}
uses: "nwtgck/[email protected]"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: "${{ secrets.NETLIFY_AUTH_TOKEN }}"
NETLIFY_SITE_ID: "${{ secrets.NETLIFY_SITE_ID }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Published from GitHub Actions'
publish-dir: './build'
github-token: "${{ secrets.GITHUB_TOKEN }}"
deploy-message: "Published from GitHub Actions"
publish-dir: "./build"

enable-pull-request-comment: true
overwrites-pull-request-comment: false
enable-commit-comment: false
enable-commit-status: true

# TODO: once we make main branch default we should change master->main
production-branch: 'master'
production-branch: "master"
production-deploy: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

alias: ${{ github.event_name == 'push' && github.ref_name || '' }}
alias: "${{ github.event_name == 'push' && github.ref_name || '' }}"

enable-github-deployment: ${{ github.event_name == 'push' && 'true' || 'false' }}
github-deployment-environment: ${{ github.event_name == 'push' && github.ref_name || format('pull-request-{0}', github.event.number) }}
enable-github-deployment: ${{ github.event_name == 'push' }}
github-deployment-environment: "${{ github.event_name == 'push' && github.ref_name || format('pull-request-{0}', github.event.number) }}"
89 changes: 55 additions & 34 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,82 @@
name: "Daily Build & Deploy to Netlify"
on:
workflow_dispatch:
push:
branches:
- "main"
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
hourly-build-and-deploy:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Checking out the repository
uses: actions/checkout@v4
name: "Hourly build & deploy"
runs-on: "ubuntu-latest"

if: !contains(github.event.head_commit.message, '[ci skip]')

- name: Installing Nix
uses: cachix/install-nix-action@v23
steps:
- name: "Checking out the repository"
uses: "actions/checkout@v4"
with:
nix_path: nixpkgs=channel:nixos-unstable
fetch-depth: 0

- name: "Installing Nix"
uses: "cachix/install-nix-action@v23"

- name: Setup Cachix
uses: cachix/cachix-action@v12
- name: "Setup Cachix"
uses: "cachix/cachix-action@v12"
with:
name: nixos-homepage
name: "nixos-homepage"
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"

- name: Update content
- name: "Update content"
run: |
bash ./scripts/update.sh
nix flake lock \
--update-input released-nixpkgs-unstable \
--update-input released-nixpkgs-stable \
--update-input released-nix-unstable \
--update-input released-nix-stable \
--update-input nix-pills
- name: Building nixos.org
- name: "Build"
run: |
nix build
nix develop --command npm install
nix develop --command npm run build
mkdir build
cp -RL ./result/* ./result/.well-known/ ./build/
cp -RL ./dist/* ./build/
- name: Deploy to Netlify
uses: nwtgck/[email protected]
- name: "Deploy to Netlify"
if: ${{ github.repository == 'NixOS/nixos-homepage' }}
uses: "nwtgck/[email protected]"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: "${{ secrets.NETLIFY_AUTH_TOKEN }}"
NETLIFY_SITE_ID: "${{ secrets.NETLIFY_SITE_ID }}"
with:
production-branch: "master"
production-deploy: true
github-token: "${{ secrets.GITHUB_TOKEN }}"
deploy-message: "Published from GitHub Actions"
publish-dir: "./build"
deploy-message: "Deploy from GitHub Actions"

enable-pull-request-comment: true
enable-commit-comment: true
enable-commit-status: true
overwrites-pull-request-comment: false
if: github.repository == 'NixOS/nixos-homepage'
enable-commit-comment: false
enable-commit-status: true

# TODO: once we make main branch default we should change master->main
production-branch: "master"
production-deploy: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

alias: "${{ github.event_name == 'push' && github.ref_name || '' }}"

enable-github-deployment: ${{ github.event_name == 'push' }}
github-deployment-environment: "${{ github.event_name == 'push' && github.ref_name || format('pull-request-{0}', github.event.number) }}"

- name: Commit updated files and push them to master branch
uses: stefanzweifel/git-auto-commit-action@v4
- name: "Commit updated files and push them to master branch"
if: ${{ github.repository == 'NixOS/nixos-homepage' }}
uses: "stefanzweifel/git-auto-commit-action@v4"
with:
commit_message: "Daily update [ci skip]"
branch: "master"
file_pattern: flake.lock blog/announcements.xml
commit_user_name: NixOS webmaster
commit_user_email: [email protected]
commit_author: GitHub Actions <[email protected]>
if: github.repository == 'NixOS/nixos-homepage'
file_pattern: "flake.lock blog/announcements.xml"
commit_user_name: "NixOS webmaster"
commit_user_email: "[email protected]"
commit_author: "GitHub Actions <[email protected]>"
22 changes: 11 additions & 11 deletions .github/workflows/update-flake-lock.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: update-flake-lock
name: "Update flake.lock"
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00

jobs:
lockfile:
runs-on: ubuntu-latest
runs-on: "ubuntu-latest"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v23
- name: "Checkout repository"
uses: "actions/checkout@v4"

- name: "Install Nix"
uses: "cachix/install-nix-action@v23"
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v20
- name: "Update flake.lock"
uses: "DeterminateSystems/update-flake-lock@v20"
with:
# we update nixos-common-styles manual
# and the rest of the inputs are content inputs
inputs: nixpkgs
inputs: nixpkgs flake-utils
45 changes: 4 additions & 41 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,48 +1,11 @@
*.html
*.html.in
*.xhtml

/nixos/manual/
/nixos/nix-pills/
/nixpkgs/manual/
/nix/manual/

/manual/
/guides/

/images/screenshots/nixos-*-small.png

/.direnv/
/build/
/demos/*.cast
/demos/*.svg
/tmp.*
/favicon.png
/favicon.ico
/blog/announcements-rss.xml
/blog/stories-rss.xml
/site-styles/common-styles
/site-styles/assets.tmp/
/nixos-release.tt
/robots.txt

/result*
/styles


# build output
/dist/
# generated types
/.astro/

# dependencies
/node_modules/

# logs
/npm-debug.log*
/yarn-debug.log*
/yarn-error.log*
/pnpm-debug.log*

# macOS-specific files
.DS_Store
/public/manual/
/public/guides/nix-pills/
/public/demos/*.cast
/public/demos/*.svg
20 changes: 0 additions & 20 deletions 404.tt

This file was deleted.

5 changes: 0 additions & 5 deletions Dockerfile

This file was deleted.

Loading

0 comments on commit 39c8714

Please sign in to comment.