Release and Deploy collection #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# The below is copied from the following URL and modified slightly | |
# https://dev.to/imjoseangel/release-and-deploy-ansible-collection-with-github-actions-4a62 | |
name: Release and Deploy collection | |
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
jobs: | |
releaseanddeploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.9] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get current version | |
id: cversion | |
run: echo "::set-output name=version::$(grep version galaxy.yml | sed -e 's:^.* ::')" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
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 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.cversion.outputs.version }} | |
release_name: Release v${{ steps.cversion.outputs.version }} | |
body: | | |
# Ansible Collection: blinklabs.cardano | |
Install with: | |
ansible-galaxy collection install -r requirements.yml -f | |
The requirements.yml needs to have the following format and content: | |
--- | |
collections: | |
- https://github.com/blinklabs-io/ansible-cardano/releases/download/v${{ steps.cversion.outputs.version }}/blinklabs-cardano-${{ steps.cversion.outputs.version }}.tar.gz | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: blinklabs-cardano-${{ steps.cversion.outputs.version }}.tar.gz | |
asset_name: blinklabs-cardano-${{ steps.cversion.outputs.version }}.tar.gz | |
asset_content_type: application/tar+gzip | |
- name: Publish Ansible collection to Galaxy | |
run: ansible-galaxy collection publish blinklabs-cardano-${{ steps.cversion.outputs.version }}.tar.gz --api-key ${{ secrets.GALAXYSTAGE_API_KEY }} --server https://galaxy-stage.ansible.com/ | |
#run: ansible-galaxy collection publish blinklabs-cardano-${{ steps.cversion.outputs.version }}.tar.gz --api-key ${{ secrets.GALAXY_API_KEY }} |