|
| 1 | +name: Update registry |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + registry: |
| 11 | + name: Update registry |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + actions: write |
| 15 | + contents: read |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + - uses: julia-actions/add-julia-registry@v2 |
| 19 | + with: |
| 20 | + key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 21 | + registry: bhftbootcamp/Green |
| 22 | + - uses: julia-actions/setup-julia@v2 |
| 23 | + with: |
| 24 | + version: 1.9 |
| 25 | + - uses: julia-actions/cache@v2 |
| 26 | + - name: Configure Git |
| 27 | + run: | |
| 28 | + sudo apt-get update -qq && sudo apt-get install -y -qq git |
| 29 | + git config --global user.name github-actions[bot] |
| 30 | + git config --global user.email github-actions[bot]@users.noreply.github.com |
| 31 | + - name: Updating package version in registers |
| 32 | + run: | |
| 33 | + julia -e ' |
| 34 | + using Pkg |
| 35 | + |
| 36 | + Pkg.add("LocalRegistry") |
| 37 | + Pkg.develop(url = "git@github.com:${{ github.repository }}.git") |
| 38 | +
|
| 39 | + using LocalRegistry |
| 40 | + using TOML |
| 41 | + |
| 42 | + package_name = match(r"^.*/(.*?)(\.jl)?(\.git)?$", "${{ github.repository }}") |
| 43 | + package_name == nothing && error("Invalid package name: ${{ github.repository }}") |
| 44 | + package_name = package_name[1] |
| 45 | + |
| 46 | + package_dir = joinpath(DEPOT_PATH[1], "dev", package_name) |
| 47 | + project_toml = TOML.parsefile(joinpath(package_dir, "Project.toml")) |
| 48 | + version = VersionNumber(project_toml["version"]) |
| 49 | + |
| 50 | + LocalRegistry.register( |
| 51 | + package_name, |
| 52 | + repo = "https://github.com/${{ github.repository }}.git", |
| 53 | + registry = "git@github.com:bhftbootcamp/Green.git", |
| 54 | + ignore_reregistration = true, |
| 55 | + ) |
| 56 | + |
| 57 | + run(Cmd(`git tag -f "v$version"`, dir = package_dir)) |
| 58 | + run(Cmd(`git push --force origin "v$version"`, dir = package_dir)) |
| 59 | + ' |
0 commit comments