Skip to content

Bump version: 0.21.4 → 0.22.0 #47

Bump version: 0.21.4 → 0.22.0

Bump version: 0.21.4 → 0.22.0 #47

Workflow file for this run

---
name: Build Ansible Collection
env:
# Note the use of "-" in the package name (not ".")
package: cdillc-splunk
# Inspiration from:
# https://github.com/imjoseangel/ansiblecommon/blob/devel/.github/workflows/release.yml
# https://github.com/artis3n/ansible-collection-github/blob/master/.github/workflows/deploy.yml
# Controls when the workflow will run
on:
push:
tags:
- "v*"
# Only run if the 'v*' tag has been created. Unittest could be run in another workflow, once that's setup
# branches:
# - main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
timeout-minutes: 30
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Get current version
id: cversion
run: echo "version=$(grep ^version galaxy.yml | awk -F'"' '{ print $2 }')" >> $GITHUB_OUTPUT
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install --upgrade ansible
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build Ansible Collection
run: |
ansible-galaxy collection build --force
echo "Contents of ${{github.workspace}}"
ls -lsh "${{github.workspace}}"
- name: Create GitHub Release and upload artifact
uses: softprops/action-gh-release@v1
id: create_release
if: contains(github.ref, 'tags/v')
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
files: ${{env.package}}-${{steps.cversion.outputs.version}}.tar.gz
- name: Deploy Ansible collection to Galaxy
run: ansible-galaxy collection publish ${{env.package}}-${{ steps.cversion.outputs.version }}.tar.gz --token ${{ secrets.GALAXY_API_KEY }}
if: contains(github.ref, 'tags/v')