mirror of
https://github.com/julia-actions/julia-buildpkg.git
synced 2026-02-12 01:16:54 +08:00
Add localregistry input option (#38)
* Add localregistry input option Option to add local registries to build process by specifying their url (https). Authentication to the repos via user GitHub token. * Backward compatible keyword syntax and Wrap new code in VERSION > 1.5 * Update Interface&README, add git_cli amd remove token flag Provide multiple remotes separated with | Add example to ReadMe Support for private repos/packages with SSH protocol * Update README.md Co-authored-by: Sascha Mann <git@mail.saschamann.eu> * Update action.yml Co-authored-by: Sascha Mann <git@mail.saschamann.eu> * Print warn mesasge if git_cli = true with Julia<1.7. * Add `::notice::` formatting --------- Co-authored-by: Sascha Mann <git@mail.saschamann.eu>
This commit is contained in:
26
README.md
26
README.md
@@ -43,3 +43,29 @@ is already set. If you want another registry flavor (i.e. `conservative`) this
|
|||||||
should be defined in the `env:` section of the relevant workflow or step. See
|
should be defined in the `env:` section of the relevant workflow or step. See
|
||||||
[Registry flavors](https://pkgdocs.julialang.org/dev/registries/#Registry-flavors)
|
[Registry flavors](https://pkgdocs.julialang.org/dev/registries/#Registry-flavors)
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
|
### Adding Local Registries
|
||||||
|
|
||||||
|
Personal registries, e.g. created with [LocalRegistry.jl](https://github.com/GunnarFarneback/LocalRegistry.jl), can be added to the CI using the `localregistry` input option. If the personal registry as well as packages needed in the current project are public, no additional setup is required if the registry url is specified in https-format.
|
||||||
|
|
||||||
|
If the registry contains private packages, or is itself private, the ssh protocol should to be used. The user has to provide the corresponding private SSH-keys to the `ssh-agent` to access packages and registry. This can be conveniently done using the [webfactory/ssh-agent](https://github.com/webfactory/ssh-agent) action. A snippet illustrating the usage of (private) personal registries is shown below
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
# Adding private SSH keys (only necessary for accessing private packages and/or
|
||||||
|
# when providing Registry-link in ssh format)
|
||||||
|
- uses: webfactory/ssh-agent@v0.8.0
|
||||||
|
with:
|
||||||
|
ssh-private-key: |
|
||||||
|
${{ secrets.PRIVATE_DEPLOY_KEY }}
|
||||||
|
${{ secrets.PRIVATE_DEPLOY_KEY2 }}
|
||||||
|
- uses: julia-actions/julia-buildpkg@v1
|
||||||
|
with:
|
||||||
|
localregistry: |
|
||||||
|
https://github.com/username/PersonalRegistry.git
|
||||||
|
git@github.com:username2/PersonalRegistry2.git
|
||||||
|
git_cli: false # = JULIA_PKG_USE_CLI_GIT. Options: true | false (default)
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
For Julia 1.7 and above, the `git_cli` option can be used to set the `JULIA_PKG_USE_CLI_GIT` [environment flag](https://docs.julialang.org/en/v1/manual/environment-variables/), for additional control of the SSH configuration used by `Pkg` to add/dev packages.
|
||||||
32
action.yml
32
action.yml
@@ -13,6 +13,14 @@ inputs:
|
|||||||
precompile:
|
precompile:
|
||||||
description: 'Whether to allow auto-precompilation (via the `JULIA_PKG_PRECOMPILE_AUTO` env var). Options: yes | no. Default value: no.'
|
description: 'Whether to allow auto-precompilation (via the `JULIA_PKG_PRECOMPILE_AUTO` env var). Options: yes | no. Default value: no.'
|
||||||
default: 'no'
|
default: 'no'
|
||||||
|
localregistry:
|
||||||
|
description: 'Add local registries hosted on GitHub. Specified by providing the url (https/ssh) to the repositories as a newline (\n) seperated list.
|
||||||
|
User is responsible for setting up the necessary SSH-Keys to access the repositories if necessary.'
|
||||||
|
default: ''
|
||||||
|
git_cli:
|
||||||
|
description: 'Determine if Pkg uses the cli git executable (Julia >= 1.7). Might be necessary for more complicated SSH setups.
|
||||||
|
Options: true | false. Default : false'
|
||||||
|
default: 'false'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
@@ -22,8 +30,30 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- run: |
|
- run: |
|
||||||
import Pkg
|
import Pkg
|
||||||
VERSION >= v"1.5-" && Pkg.Registry.add("General")
|
|
||||||
|
# Determine if Pkg uses git-cli executable instead of LibGit2
|
||||||
|
VERSION >= v"1.7-" && (ENV["JULIA_PKG_USE_CLI_GIT"] = ${{ inputs.git_cli }})
|
||||||
|
|
||||||
|
if VERSION < v"1.7-" && ${{ inputs.git_cli }} == true
|
||||||
|
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if VERSION >= v"1.5-"
|
||||||
|
Pkg.Registry.add("General")
|
||||||
|
|
||||||
|
# If provided add local registries
|
||||||
|
if !isempty("${{ inputs.localregistry }}")
|
||||||
|
local_repos = split("${{ inputs.localregistry }}", "\n") .|> string
|
||||||
|
for repo_url in local_repos
|
||||||
|
isempty(repo_url) && continue
|
||||||
|
Pkg.Registry.add(Pkg.RegistrySpec(; url = repo_url))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
VERSION >= v"1.1.0-rc1" ? retry(Pkg.build)(verbose=true) : retry(Pkg.build)()
|
VERSION >= v"1.1.0-rc1" ? retry(Pkg.build)(verbose=true) : retry(Pkg.build)()
|
||||||
shell: julia --color=yes --project=${{ inputs.project }} {0}
|
shell: julia --color=yes --project=${{ inputs.project }} {0}
|
||||||
env:
|
env:
|
||||||
JULIA_PKG_PRECOMPILE_AUTO: "${{ inputs.precompile }}"
|
JULIA_PKG_PRECOMPILE_AUTO: "${{ inputs.precompile }}"
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|||||||
Reference in New Issue
Block a user