-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (95 loc) · 3.38 KB
/
autoupdate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: autoupdate
on:
# push:
workflow_dispatch:
schedule:
- cron: '0 12 * * *' # Every day at noon
jobs:
regenerate-general:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: "CodeDownIO/registry2nix"
ref: "81a79057d16107861161fe05cb7e04808c685e2a"
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:release-22.11
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Install nix-prefetch-git
run: |
nix profile install nixpkgs#nix-prefetch-git
- uses: haskell/actions/setup@v2
with:
ghc-version: "9.2.8"
stack-version: "latest"
enable-stack: true
- name: Cache ~/.stack
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-9.2.8-stack-2
- name: Build
run: |
stack build --system-ghc
- name: Install
run: |
stack install --system-ghc
- name: Check out latest JuliaRegistries/General repo
uses: actions/checkout@v3
with:
repository: "JuliaRegistries/General"
path: JuliaRegistriesGeneral
- name: Check out latest CodeDownIO/General repo
uses: actions/checkout@v3
with:
repository: "CodeDownIO/General"
path: CodeDownIOGeneral
- name: Generate the update
run: |
cp CodeDownIOGeneral/failures.yml JuliaRegistriesGeneral/failures.yml
set +e
registry2nix-exe \
--print-failures \
--repo JuliaRegistriesGeneral \
--initial-repo CodeDownIOGeneral \
--ignore-previous-failures CodeDownIOGeneral/failures.yml \
--write-new-failures JuliaRegistriesGeneral/failures.yml \
--num-workers 15
exit 0
- name: Make a new commit with the changes
run: |
pushd JuliaRegistriesGeneral
JULIA_REGISTRIES_COMMIT=$(git rev-parse HEAD)
popd
# Tricky method to ensure the commit we're about to create for CodeDownIOGeneral
# exactly matches the new state of JuliaRegistries
# (except for this workflow file)
rm -rf JuliaRegistriesGeneral/.github/workflows
mkdir -p JuliaRegistriesGeneral/.github/workflows
cp CodeDownIOGeneral/.github/workflows/autoupdate.yml JuliaRegistriesGeneral/.github/workflows/autoupdate.yml
rm -rf JuliaRegistriesGeneral/.git
mv CodeDownIOGeneral/.git JuliaRegistriesGeneral/.git
cd JuliaRegistriesGeneral/
git status
echo "------------------"
git add .
git config --global user.email "registry2nix@codedown.io"
git config --global user.name registry2nix
git commit -m "Automatic update to JuliaRegistries/General/$JULIA_REGISTRIES_COMMIT"
echo "------------------"
git status
echo "------------------"
git diff HEAD~1 HEAD --shortstat
# - name: Push the changes
# run: |
# cd JuliaRegistriesGeneral
# git push https://codedownio:${{secrets.CODEDOWN_GENERAL_PAT}}@github.com/codedownio/General.git HEAD:master
- name: Push the changes
uses: ad-m/github-push-action@master
with:
repository: codedownio/General
directory: JuliaRegistriesGeneral
# github_token: ${{ secrets.CODEDOWN_GENERAL_PAT }}
github_access_token: ${{ secrets.GITHUB_TOKEN }}
branch: master