Bump Spicetify Packages #264
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
name: "Bump Spicetify Packages" | |
on: | |
schedule: | |
- cron: '19 18 * * *' | |
push: | |
paths: | |
- 'pkgs/nvfetcher.toml' | |
# repository_dispatch: | |
workflow_dispatch: | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
NIXPKGS_ALLOW_UNFREE: 1 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT }} | |
path: src | |
- name: Check free-disk-space (before clean) | |
run: df -h | |
- name: free-disk-cache | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
- name: Check free-disk-space (after clean) | |
run: df -h | |
- name: Install nix | |
uses: cachix/install-nix-action@v21 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Check for manifest change | |
id: manifest | |
run: | | |
URL="https://api.github.com/repos/spicetify/spicetify-themes" | |
START=$(date -d 'yesterday' --utc --iso-8601=seconds) | |
END=$(date --utc --iso-8601=seconds) | |
LIST=$(curl -s "${URL}/commits?since=${START}&until=${END}" | tr "\n" " " | jq -r '.[] | "\(.sha)"') | |
# NOTE: make sure to exit if its a empty list | |
if [ -z "$LIST" ]; then | |
echo "check=false" >> "$GITHUB_OUTPUT" | |
else | |
HEAD=$(echo "$LIST" | head -n 1) | |
TAIL=$(echo "$LIST" | tail -n 1) | |
FILES=$(curl -s "${URL}/compare/${TAIL}...${HEAD}" | jq -r '.files[].filename') | |
if [[ "$FILES" == *'manifest.json'* ]]; then | |
echo "check=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "check=false" >> "$GITHUB_OUTPUT" | |
fi | |
fi | |
- name: Download Manifest | |
uses: actions/checkout@v4 | |
if: steps.manifest.outputs.check == 'true' | |
with: | |
repository: spicetify/spicetify-themes | |
path: themes | |
- name: Move Manifest | |
if: steps.manifest.outputs.check == 'true' | |
run: | | |
cp -f themes/manifest.json src/ | |
- name: Update Manifest | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
if: steps.manifest.outputs.check == 'true' | |
with: | |
repository: src/ | |
file_pattern: "manifest.json" | |
commit_message: "chore: Bump Manifest" | |
- name: Run nvfetcher | |
run: | | |
nix run github:berberman/nvfetcher -- -o src/pkgs/_sources -c src/pkgs/nvfetcher.toml | |
- name: Show flake metadata | |
run: | | |
cd src/ | |
nix flake metadata --impure | |
- name: Check free-disk-space (before nix build) | |
run: df -h | |
- name: Build nix packages | |
run: | | |
cd src/ | |
nix build .#checks.x86_64-linux.default --impure -v | |
- name: Check free-disk-space (after nix build) | |
run: df -h | |
- name: Push updates | |
if: ${{ success() }} | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
repository: src/ | |
commit_message: "chore: Bump Spicetify Packages" | |
file_pattern: "pkgs/_sources/" |