From d75d5803852fb0833767dc969a4581ac13204e22 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 8 Jul 2024 16:56:34 -0400 Subject: [PATCH] ci: merge and cleanup workflows (#282) * ci: only format nix files in upstream repo * ci: merge release & publish workflows * ci: merge flake.lock & port update workflows * ci: conditionally run website workflow --- .github/workflows/ci.yml | 2 +- .github/workflows/publish.yml | 49 ------------------------- .github/workflows/release.yml | 39 ++++++++++++++++++++ .github/workflows/update-flake.yml | 31 ---------------- .github/workflows/update-locks.yml | 57 ++++++++++++++++++++++++++++++ .github/workflows/update-ports.yml | 34 ------------------ .github/workflows/website.yml | 10 ++++++ 7 files changed, 107 insertions(+), 115 deletions(-) delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/update-flake.yml create mode 100644 .github/workflows/update-locks.yml delete mode 100644 .github/workflows/update-ports.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 307bab44..9cae5033 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: format: name: Format Nix files - if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' + if: github.repository_owner == 'Catppuccin' && github.event_name == 'push' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 49cf7c8c..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Publish flake - -on: - push: - tags: ["v*.*.*"] - workflow_dispatch: - inputs: - tag: - description: "The tag to publish" - type: string - required: true - -jobs: - flakehub: - name: FlakeHub - - runs-on: ubuntu-latest - - permissions: - id-token: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: ${{ inputs.tag || github.ref }} - - - name: Install Nix - uses: cachix/install-nix-action@V27 - - - name: Push to FlakeHub - uses: DeterminateSystems/flakehub-push@v4 - with: - tag: ${{ inputs.tag || github.ref_name }} - visibility: "public" - - flakestry: - name: Flakestry - - runs-on: ubuntu-latest - - permissions: - id-token: write - - steps: - - name: Publish on Flakestry - uses: flakestry/flakestry-publish@main - with: - version: ${{ inputs.tag || github.ref_name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 907dd091..409d8803 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,14 +7,53 @@ on: jobs: release-please: name: Make release + runs-on: ubuntu-latest permissions: contents: write pull-requests: write + outputs: + release_created: ${{ steps.release-please-run.outputs.release_created }} + tag_name: ${{ steps.release-please-run.outputs.tag_name }} + steps: - uses: googleapis/release-please-action@v4 + id: release-please-run with: release-type: simple package-name: catppuccin/nix + + publish: + name: Publish to Flake registries + if: ${{ needs.release-please.outputs.release_created }} + needs: release-please + + runs-on: ubuntu-latest + + env: + TAG_NAME: ${{ needs.release-please.outputs.tag_name }} + + permissions: + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ env.TAG_NAME }} + + - name: Install Nix + uses: cachix/install-nix-action@V27 + + - name: Publish on Flakestry + uses: flakestry/flakestry-publish@main + with: + version: ${{ env.TAG_NAME }} + + - name: Push to FlakeHub + uses: DeterminateSystems/flakehub-push@v4 + with: + tag: ${{ env.TAG_NAME }} + visibility: "public" diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml deleted file mode 100644 index 0ff94616..00000000 --- a/.github/workflows/update-flake.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Update flake.lock - -on: - schedule: - # run every friday - - cron: "0 0 * * 5" - workflow_dispatch: - -jobs: - update: - name: Run update & create PR - - runs-on: ubuntu-latest - - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Nix - uses: cachix/install-nix-action@V27 - - - uses: DeterminateSystems/update-flake-lock@v23 - with: - path-to-flake-dir: "./dev" - commit-msg: "chore: update dev flake inputs" - pr-title: "chore: update dev flake inputs" - token: ${{ github.token }} diff --git a/.github/workflows/update-locks.yml b/.github/workflows/update-locks.yml new file mode 100644 index 00000000..3b6fff6f --- /dev/null +++ b/.github/workflows/update-locks.yml @@ -0,0 +1,57 @@ +name: Update lockfiles + +on: + schedule: + # run every friday + - cron: "0 0 * * 5" + workflow_dispatch: + +jobs: + flake: + name: Update flake.lock + + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@V27 + + - uses: DeterminateSystems/update-flake-lock@v23 + with: + path-to-flake-dir: "./dev" + commit-msg: "chore: update dev flake inputs" + pr-title: "chore: update dev flake inputs" + token: ${{ github.token }} + + ports: + name: Update port sources + + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@V27 + + - name: Install npins + run: nix profile install 'nixpkgs#npins' + + - uses: getchoo/update-npins@v0.1.2 + with: + npins-directory: "./.sources" + commit-message: "chore(modules): update ports" + pr-title: "chore(modules): update ports" + token: ${{ github.token }} diff --git a/.github/workflows/update-ports.yml b/.github/workflows/update-ports.yml deleted file mode 100644 index 55a58882..00000000 --- a/.github/workflows/update-ports.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Update ports - -on: - schedule: - # run every other weekday - - cron: "0 0 * * 1,3,5" - workflow_dispatch: - -jobs: - update: - name: Run update & create PR - - runs-on: ubuntu-latest - - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Nix - uses: cachix/install-nix-action@V27 - - - name: Install npins - run: nix profile install 'nixpkgs#npins' - - - uses: getchoo/update-npins@v0.1.2 - with: - npins-directory: "./.sources" - commit-message: "chore: update ports" - pr-title: "chore: update ports" - token: ${{ github.token }} diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 4f5da8b6..f57d5017 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -3,7 +3,17 @@ name: Build & deploy website on: push: branches: [main] + paths: + - 'docs/**' + - 'CHANGELOG.md' + - '**.lock' + - '**.nix' pull_request: + paths: + - 'docs/**' + - 'CHANGELOG.md' + - '**.lock' + - '**.nix' workflow_dispatch: jobs: