Skip to content

Commit

Permalink
CI: add reusable actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fufexan committed Aug 12, 2023
1 parent d20837b commit c65907b
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 95 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Commit

on:
workflow_call:
inputs:
message:
required: true
type: string

jobs:
commit:
runs-on: ubuntu-latest
steps:
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: ${{ inputs.message }}
commit_user_name: Mihai Fufezan
commit_user_email: [email protected]
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
10 changes: 5 additions & 5 deletions .github/workflows/man-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
# submodules: recursive
- name: Build man pages
run: make man
- uses: stefanzweifel/git-auto-commit-action@v4
name: Commit
with:
commit_message: "[gha] build man pages"
commit_author: Mihai Fufezan <[email protected]>

push:
uses: ./.github/workflows/commit.yml
with:
message: "[gha] build man pages"
7 changes: 7 additions & 0 deletions .github/workflows/nix-build-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Nix Packages

on: [push, pull_request, workflow_dispatch]

jobs:
build:
uses: ./.github/workflows/build.yml
26 changes: 0 additions & 26 deletions .github/workflows/nix-build.yaml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Nix Build

on:
workflow_call:

jobs:
build:
strategy:
matrix:
package:
- hyprland
- hyprland-nvidia
- xdg-desktop-portal-hyprland

uses: ./.github/workflows/nix.yml
with:
command: nix build -L .#${{ matrix.package }}
54 changes: 20 additions & 34 deletions .github/workflows/nix-update-inputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,26 @@ name: "Nix update"

on:
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * *' # daily

jobs:
update:
name: "inputs"
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install nix
uses: cachix/install-nix-action@v20
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- name: Update lockfile
run: nix/update-inputs.sh

- uses: cachix/cachix-action@v12
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Build packages
run: nix flake check --print-build-logs --accept-flake-config

- name: Build Waybar-Hyprland
run: nix build .#waybar-hyprland --print-build-logs

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Nix: bump inputs"
commit_author: Mihai Fufezan <[email protected]>
uses: ./.github/workflows/nix.yml
with:
command: nix/update-inputs.sh

build:
needs: update
uses: ./.github/workflows/nix-build.yml

build-waybar:
needs: update
uses: ./.github/workflosw/nix.yml
with:
command: nix build -L .#waybar-hyprland

push:
needs: [build, build-waybar]
uses: ./.github/workflows/commit.yml
with:
message: "Nix: bump inputs"
39 changes: 9 additions & 30 deletions .github/workflows/nix-update-wlroots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,12 @@ on: [push, workflow_dispatch]

jobs:
update:
name: "wlroots"
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install nix
uses: cachix/install-nix-action@v20
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- name: Update lockfile
run: nix/update-wlroots.sh

- uses: cachix/cachix-action@v12
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Build packages
run: nix flake check --print-build-logs --accept-flake-config

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Nix: bump wlroots"
commit_author: Mihai Fufezan <[email protected]>
uses: ./.github/workflows/nix.yml
with:
command: nix/update-wlroots.sh

push:
needs: update
uses: ./.github/workflows/commit.yml
with:
message: "Nix: bump wlroots"
26 changes: 26 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Nix

on:
workflow_call:
inputs:
command:
required: true
type: string

jobs:
nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v12
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: ${{ inputs.command }}

0 comments on commit c65907b

Please sign in to comment.