Automates the upload of files/artefacts from GitHub Actions to Sonatype Nexus servers
This repository contains a GitHub Action to upload files to Sonatype Nexus servers.
The action looks for a cURL configuration file in the current working directory called:
.netrc
This should contain the Nexus server name, along with credentials providing write access to the repository.
Here's an example of the configuration file content/format:
machine [nexus-server]
login [nexus-username]
password [nexus-password]
NOTE: respect the indentation of the second and third lines in the example above
A local folder containing the files to upload is mandatory. If no file extensions are specified, then the default behaviour is wildcard (*) file matching. You can prevent this, by specifying a file suffix/extension restricting the files to be uploaded to a subset of the folder content.
- nexus_username
- nexus_password
- nexus_server
- nexus_repository
- upload_directory
- filename_suffix
- testing [ true | false ]
When testing is set to "true" an upload directory and sample text file (with a date/time stamp) will automatically be created. This prevents the need to create test data or add files directly to your repository when testing the action.
- errors [ true | false ]
- successes [ numeric value ]
- failures [ numeric value ]
An example workflow has been provided that can be invoked on demand:
A shell script has also been provided, along with a setup file. The shell script acts as a thin wrapper, extracting the functional shell code from the YAML file, then running it. The supplementary setup file provides the required parameters that would otherwise be pass as inputs by a workflow. You still need to create a .netrc file to configure the environment with the nexus server and credentials providing write access to the repository.