@@ -2,19 +2,51 @@ name: build
22
33on:
44 pull_request:
5+ branches: master
56 push:
7+ branches: master
8+
69jobs:
710 tests:
811 runs-on: ubuntu-latest
912 steps:
10− - uses: actions/checkout@v2
11− - uses: cachix/install-nix-action@v12
12− with:
13− nix_path: nixpkgs=channel:nixos-20.09
14− - uses: actions/cache@v2
15− with:
16− path: |
17− output
18− .psc-package
19− key: ${{ runner.os }}-build-products
20− - run: nix-shell --run 'make ci'
13+ - uses: actions/checkout@v2
14+ with:
15+ ref: ${{ github.event.pull_request.head.ref }}
16+ persist-credentials: false
17+
18+ - uses: cachix/install-nix-action@v12
19+ with:
20+ nix_path: nixpkgs=channel:nixos-20.09
21+
22+ - name: Generate packages.json file from the package set
23+ run: |
24+ # Generate the new packages.json file
25+ nix-shell --run 'make generate'
26+
27+ # Run verification steps
28+ nix-shell --run 'make verify-registry'
29+ nix-shell --run 'make test-psc-package'
30+
31+ - name: Check for and commit modified files
32+ id: git-check
33+ run: echo ::set-output name=modified::$(if git diff --quiet; then echo "false"; else echo "true"; fi)
34+
35+ - name: Push changes
36+ if: steps.git-check.outputs.modified == 'true'
37+ run: |
38+ git config --global user.name 'GitHub Action'
39+ git config --global user.email 'actions@github.com'
40+ git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
41+ git pull --ff-only
42+ git commit -am "Update packages.json file"
43+ git push
44+
45+ - uses: actions/cache@v2
46+ with:
47+ path: |
48+ output
49+ .psc-package
50+ key: ${{ runner.os }}-build-products
51+
52+ - run: nix-shell --run 'cd src && spago verify-set'