Skip to content

add documentation (#1) #36

add documentation (#1)

add documentation (#1) #36

Workflow file for this run

---
name: "Release"
on:
push:
branches:
- "master"
permissions:
contents: "write"
jobs:
check_version_update:
runs-on: "ubuntu-latest"
outputs:
version: ${{ steps.galaxy_yml_version.outputs.value }}
is_updated: ${{ steps.compare_versions.outputs.value }}
steps:
- uses: "actions/checkout@v4"
- name: "Install PyYAML"
run: pip install pyyaml
- name: "Read version from galaxy.yml"
id: galaxy_yml_version
run: |
import yaml
import os
with open('galaxy.yml', 'r') as file:
data = yaml.safe_load(file)
with open(os.environ['GITHUB_OUTPUT'], 'a') as output_file:
output_file.write(f"value={data['version']}\n")
shell: "python"
- name: "Compare with latest git tag"
id: compare_versions
run: |
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo 'v0.0.0')
if [[ "${{ steps.galaxy_yml_version.outputs.value }}" != "$latest_tag" ]]; then
echo "value=true" >> $GITHUB_OUTPUT
else
echo "value=false" >> $GITHUB_OUTPUT
fi
publish:
runs-on: "ubuntu-latest"
needs: check_version_update
if: needs.check_version_update.outputs.is_updated == 'true'
steps:
- uses: "actions/checkout@v4"
- name: "Build the Collection"
run: ansible-galaxy collection build
- name: "Publish to Galaxy"
run: >-
ansible-galaxy collection publish
--api-key ${{ secrets.GALAXY_API_KEY }}
./artyorsh-smarthome-${{ needs.check_version_update.outputs.version }}.tar.gz
- name: "Publish a new tag"
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ needs.check_version_update.outputs.version }}
git push origin ${{ needs.check_version_update.outputs.version }}