README: add npins docs #52
Workflow file for this run
This file contains hidden or 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: "Build and populate cache" | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| permissions: read-all | |
| jobs: | |
| release-check: | |
| permissions: {} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is-release: ${{ steps.condition-check.outputs.match }} | |
| steps: | |
| - id: condition-check | |
| uses: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b # v2.0.2 | |
| with: | |
| # matches: package_name: vX.Y.Z -> vX.Y.Z where XYZ are digits (including rc, e.g: vX.Y.Z-rcN) | |
| # it detects a commit from goreleaser with a new nix package version. | |
| regex: '\s*[a-zA-Z][\w]+:\s*v\d+\.\d+\.\d+(-rc\d+)?\s*->\s*v\d+\.\d+\.\d+(-rc\d+)?' | |
| text: ${{ github.event.head_commit.message }} | |
| tests: | |
| permissions: {} | |
| needs: release-check | |
| strategy: | |
| matrix: | |
| nixPath: | |
| - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixpkgs-unstable.tar.gz | |
| - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-unstable.tar.gz | |
| - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-25.11.tar.gz | |
| runs-on: ubuntu-latest | |
| if: needs.release-check.outputs.is-release != '' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install nix | |
| uses: cachix/install-nix-action@96951a368ba55167b55f1c916f7d416bac6505fe # v31.10.3 | |
| with: | |
| nix_path: "${{ matrix.nixPath }}" | |
| extra_nix_config: | | |
| experimental-features = nix-command flakes | |
| access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
| - name: Show nixpkgs version | |
| run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version' | |
| - name: Check evaluation | |
| run: | | |
| nix-env -f . -qa \* --meta --xml \ | |
| --allowed-uris https://static.rust-lang.org \ | |
| --option restrict-eval true \ | |
| --option allow-import-from-derivation true \ | |
| --drv-path --show-trace \ | |
| -I nixpkgs=$(nix-instantiate --find-file nixpkgs) \ | |
| -I $PWD | |
| - name: Build nix packages | |
| run: nix shell -f '<nixpkgs>' nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs | |
| add-pkg: | |
| permissions: | |
| contents: write | |
| needs: [release-check, tests] | |
| runs-on: ubuntu-latest | |
| if: needs.release-check.outputs.is-release != '' | |
| steps: | |
| - name: Configure PAT for git push | |
| run: | | |
| git config --global url.https://${{ secrets.NUR_PAT }}@github.com/.insteadOf https://github.com/ | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.NUR_PAT }} | |
| - name: Make addpkg script executable | |
| run: chmod +x ./addpkg.sh | |
| - name: Execute addpkg.sh to update nix package's catalog | |
| run: ./addpkg.sh step-agent | |
| - name: Setup bot SSH signing key | |
| uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0 | |
| env: | |
| HAS_SSH_PRIVATE_KEY: ${{ secrets.STEP_TRAVIS_CI_GH_PRIVATE_SIGNING_KEY != '' }} | |
| if: ${{ env.HAS_SSH_PRIVATE_KEY == 'true' }} | |
| with: | |
| ssh-private-key: | | |
| ${{ secrets.STEP_TRAVIS_CI_GH_PRIVATE_SIGNING_KEY }} | |
| - name: Add and Commit default.nix | |
| run: | | |
| git config user.email "eng+ci@smallstep.com" | |
| git config user.name "step-ci" | |
| # Configure GH commit signing key. | |
| git config --global commit.gpgsign true | |
| git config --global gpg.format ssh | |
| git config --global user.signingkey "${{ secrets.STEP_TRAVIS_CI_GH_PUBLIC_SIGNING_KEY }}" | |
| git add default.nix && git commit -m "Add new package to default.nix" | |
| - name: Push changes | |
| run: git push |