|
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 | - master |
8 | | - schedule: |
9 | | - # rebuild everyday at 2:51 |
10 | | - # TIP: Choose a random time here so not all repositories are build at once: |
11 | | - # https://www.random.org/clock-times/?num=1&earliest=01%3A00&latest=08%3A00&interval=5&format=html&rnd=new |
12 | | - - cron: '51 2 * * *' |
13 | 8 | workflow_dispatch: |
| 9 | + |
14 | 10 | jobs: |
| 11 | + release-check: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + is-release: ${{ steps.condition-check.outputs.match }} |
| 15 | + steps: |
| 16 | + - id: condition-check |
| 17 | + uses: actions-ecosystem/action-regex-match@v2 |
| 18 | + with: |
| 19 | + # matches: package_name: vX.Y.Z -> vX.Y.Z where XYZ are digits (including release candidates: vX.Y.Z-rcN) |
| 20 | + # it detects a commit from goreleaser with a new nix package version. |
| 21 | + regex: '\s*[a-zA-Z][\w]+:\s*v\d+\.\d+\.\d+(-rc\d+)?\s*->\s*v\d+\.\d+\.\d+(-rc\d+)?' |
| 22 | + text: ${{ github.event.head_commit.message }} |
| 23 | + |
15 | 24 | tests: |
| 25 | + needs: release-check |
16 | 26 | strategy: |
17 | 27 | matrix: |
18 | | - # Set this to notify the global nur package registry that changes are |
19 | | - # available. |
20 | | - # |
21 | | - # The repo name as used in |
22 | | - # https://github.com/nix-community/NUR/blob/master/repos.json |
23 | | - nurRepo: |
24 | | - - <YOUR_REPO_NAME> |
25 | | - # Set this to cache your build results in cachix for faster builds |
26 | | - # in CI and for everyone who uses your cache. |
27 | | - # |
28 | | - # Format: Your cachix cache host name without the ".cachix.org" suffix. |
29 | | - # Example: mycache (for mycache.cachix.org) |
30 | | - # |
31 | | - # For this to work, you also need to set the CACHIX_SIGNING_KEY or |
32 | | - # CACHIX_AUTH_TOKEN secret in your repository secrets settings in |
33 | | - # Github found at |
34 | | - # https://github.com/<your_githubname>/nur-packages/settings/secrets |
35 | | - cachixName: |
36 | | - - <YOUR_CACHIX_NAME> |
37 | 28 | nixPath: |
38 | 29 | - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixpkgs-unstable.tar.gz |
39 | 30 | - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-unstable.tar.gz |
40 | 31 | - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-25.11.tar.gz |
41 | 32 | runs-on: ubuntu-latest |
| 33 | + |
| 34 | + if: needs.release-check.outputs.is-release != '' |
42 | 35 | steps: |
43 | 36 | - name: Checkout repository |
44 | 37 | uses: actions/checkout@v5 |
|
51 | 44 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} |
52 | 45 | - name: Show nixpkgs version |
53 | 46 | run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version' |
54 | | - - name: Setup cachix |
55 | | - uses: cachix/cachix-action@v16 |
56 | | - # Don't replace <YOUR_CACHIX_NAME> here! |
57 | | - if: ${{ matrix.cachixName != '<YOUR_CACHIX_NAME>' }} |
58 | | - with: |
59 | | - name: ${{ matrix.cachixName }} |
60 | | - signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' |
61 | | - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' |
62 | 47 | - name: Check evaluation |
63 | 48 | run: | |
64 | 49 | nix-env -f . -qa \* --meta --xml \ |
|
70 | 55 | -I $PWD |
71 | 56 | - name: Build nix packages |
72 | 57 | run: nix shell -f '<nixpkgs>' nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs |
73 | | - - name: Trigger NUR update |
74 | | - # Don't replace <YOUR_REPO_NAME> here! |
75 | | - if: ${{ matrix.nurRepo != '<YOUR_REPO_NAME>' }} |
76 | | - run: curl -XPOST "https://nur-update.nix-community.org/update?repo=${{ matrix.nurRepo }}" |
| 58 | + |
| 59 | + add-pkg: |
| 60 | + permissions: |
| 61 | + contents: write |
| 62 | + needs: [release-check, tests] |
| 63 | + runs-on: ubuntu-latest |
| 64 | + |
| 65 | + if: needs.release-check.outputs.is-release != '' |
| 66 | + steps: |
| 67 | + - name: Checkout repository |
| 68 | + uses: actions/checkout@v5 |
| 69 | + - name: Make addpkg script executable |
| 70 | + run: chmod +x ./addpkg.sh |
| 71 | + - name: Execute addpkg.sh to update nix package's catalog |
| 72 | + run: ./addpkg.sh step-agent-plugin |
| 73 | + - name: Add and Commit default.nix |
| 74 | + uses: EndBug/add-and-commit@v9 # Use the specific action |
| 75 | + with: |
| 76 | + add: 'default.nix' # Specifies the file(s) to add |
| 77 | + message: 'Added new nix package version' # The commit message |
| 78 | + author_name: 'github-actions[bot]' |
| 79 | + author_email: 'github-actions[bot]@users.noreply.github.com' |
| 80 | + env: |
| 81 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments