Continuous delivery workflows for software packages follow a pattern with these steps:
- Configure the project to work with the package registry
- Authenticate with the target registry
- Build the package
- Publish the package to the registry
Each language has a specific configuration that identifies the target registry and how to authenticate with it.
Language | Config File |
---|---|
JavaScript | package.json |
Ruby | .gemspec |
Java | settings.xml, pom.xml |
.Net | .csproj |
Each language will also use its own, native tooling to build and publish a package.
Language | Build, publish Commands |
---|---|
JavaScript | npm ci; npm publish |
Ruby | gem build; gem push |
Java | mvn package; maven deploy |
.Net | dotnet pack; dotnet nuget push |
The configuration files for a package also define a version number for the package being published.
Version numbers can't be reused.
Update code to reference a new version number with each new release.
-
Create a new repo and upload the files for this lesson. Note that the Java files need to be located in subdirectories. Follow the steps in this document to move the files after uploading them: Moving a file to a new location .
Specifically, the file HelloActions.java needs to have the following path:
./src/main/java/com/example/HelloActions.java
And the file HelloActionsTest.java needs to have the following path:
./src/test/java/com/example/HelloActionsTest.java
-
Edit pom.xml.
Completing this step is key to having the workflow run properly!
Replace all occurrences of
GITHUB_USERNAME
andGITHUB_REPONAME
with your GitHub username and the name for the GitHub repo you are using for this exercise.Save the pom.xml file and commit the changes to the repo.
-
In the repo select the Actions tab.
-
Select and configure the workflow Publish Java Package with Maven.
-
Select Start Commit and then select Commit New File.
-
Select the Code tab.
-
Select Create a new release.
-
Select Choose a tag.
-
For the tag name, enter
v1.0.0
. -
Select Create a new tag on publish.
-
For the release title, enter
v1.0.0
. Enter text for the body of the release as well. -
Select Publish.
-
Select the Actions tab and wait for the workflow to finish successfully. If there are errors in the workflow run, review them and make corrections where needed. If you get stuck, ask for help in the Q&A for the course.
-
Once the workflow completes, select the Code tab.
-
Refresh the page as needed until the package is listed under Packages.
-
Select the package and review the details on the package page.