A composite GitHub Action that allows to build an Ansible collection artifact in GitHub Actions CI/CD workflows.
This action is covered by the Ansible Code of Conduct.
To use the action, add the following step to your workflow file (for example .github/workflows/build-collection.yml
):
- name: Check out your collection repository
uses: actions/checkout@v4
- name: Build collection
id: build-collection
uses: ansible-community/github-action-build-collection@main
- name: Upload built collection as artifact
uses: actions/upload-artifact@v4
with:
name: my-collection
path: ${{ steps.build-collection.outputs.artifact-filename }}
The follow options can be provided to this GitHub Action.
The Python version to use for running ansible-core.
(DEFAULT: 3.12
)
The branch of tag name of ansible-core to install. This is assumed to exist in https://github.com/ansible/ansible.
(DEFAULT: stable-2.16
)
The subdirectory in which the collection's sources can be found. Must contain the galaxy.yml
file.
(DEFAULT: .
)
If provided, the collection's requirements will be written as a Galaxy requirements.yml
file to this path.
The GitHub Action provides the following outputs that can be used in further workflow steps.
The collection's full name (namespace.name).
The collection's name. For example ansible.posix
's name is posix
.
The collection's namespace. For example ansible.posix
's namespace is ansible
.
The collection's version. Will be set to 0.0.1
if no version
field is present in galaxy.yml
.
Filename of the built collection artifact.
Path to the built collection artifact.
This GitHub Action bundles a shared workflow, build-collection.yml, which allows you to build a collection, and upload the built collection artifact together with its requirements.yml
file as a GitHub artifact.
jobs:
build-collection:
name: Build collection artifact
permissions:
contents: read
uses: ansible-community/github-action-build-collection/.github/workflows/build-collection.yml@main
Please check out the workflow for the options it supports, and for which outputs it provides.
This action is primarily licensed and distributed as a whole under the GNU General Public License v3.0 or later.
See LICENSES/GPL-3.0-or-later.txt for the full text.
All files have a machine readable SDPX-License-Identifier:
comment denoting its respective license(s) or an equivalent entry in an accompanying .license
file. This conforms to the REUSE specification.