Skip to content

v2.2.1 (#60)

v2.2.1 (#60) #23

name: Deploy Ansible Galaxy Collection
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
# Important: This sets up your GITHUB_WORKSPACE environment variable
- uses: actions/checkout@v2
- name: Retrieving variables from galaxy.yml
run: |
echo "COLLECTION_NAMESPACE=`grep 'namespace:' galaxy.yml | tail -n1 | awk '{ print $2}' | tr -d \\"`" >> $GITHUB_ENV
echo "COLLECTION_NAME=`grep 'name:' galaxy.yml | tail -n1 | awk '{ print $2}' | tr -d \\"`" >> $GITHUB_ENV
echo "VERSION=`grep 'version:' galaxy.yml | tail -n1 | awk '{ print $2}' | tr -d \\"`" >> $GITHUB_ENV
- name: Printing Ansible version & custom variables
run: |
ansible --version
echo $COLLECTION_NAMESPACE
echo $COLLECTION_NAME
echo $VERSION
# Building collection
- run: |
ansible-galaxy collection build
# Deploying collection
- run: |
ansible-galaxy collection publish ./$COLLECTION_NAMESPACE-$COLLECTION_NAME-$VERSION.tar.gz --api-key ${{ secrets.ANSIBLE_GALAXY_TOKEN }}