Skip to content

CD

CD #39

Workflow file for this run

name: CD
# Controls when the action will run.
on:
# 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"
lint:
# 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@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "ansible>=2.9,<2.10" ansible-lint
mkdir -p ~/.ansible/roles
ansible-galaxy install --roles-path ~/.ansible/roles -r requirements.yml
- name: Lint with ansible-lint
run: |
# Check Ansible formatting rules
ansible-lint ./tests/sanity.yml --exclude ~/.ansible/roles
- name: Check for syntax errors
run: |
ansible-playbook ./tests/sanity.yml --syntax-check
release:
needs: lint
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: main
tag_prefix: ""
- name: Create a GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
- name: Deploy to Ansible Galaxy
uses: artis3n/ansible_galaxy_collection@v2
with:
api_key: "${{ secrets.galaxy_api_key }}"
galaxy_version: "${{ steps.tag_version.outputs.new_tag }}"