Skip to content

fixed update_version.sh #19

fixed update_version.sh

fixed update_version.sh #19

Workflow file for this run

name: Publish Ansible Galaxy Collection
on:
push:
branches:
- main # Ändern Sie dies entsprechend Ihrem Hauptbranch
jobs:
uild-and-publish:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get current commit ID
run: echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Get previous commit ID
run: |
PREV_COMMIT_ID=$(git rev-list --max-parents=0 HEAD | head -n 1)
echo "PREV_COMMIT_ID=$PREV_COMMIT_ID" >> $GITHUB_ENV
- name: Compare commits
run: |
git diff --name-only $PREV_COMMIT_ID $COMMIT_ID | grep 'requirements.yml'
if [ $? -eq 0 ]; then
echo "requirements.yml has been modified."
else
echo "No changes detected in requirements.yml."
fi
- name: Check if requirements have changed
id: check_changes
run: |
# Überprüfen Sie, ob sich plugin_requirements.yml geändert hat
dif=git diff --name-only 'plugin_requirements.yml' HEAD
echo $dif
CHANGED=$( dif | grep -q 'plugin_requirements.yml' && echo "true" || echo "false")
if [ "$CHANGED" = "true" ]; then
# Lesen Sie die Inhalte der Dateien
PLUGIN_REQS=$(cat plugin_requirements.yml)
APT_PKG_LIST=$(cat .github/workflows/apt-packages.yml)
# Setzen Sie die Outputs als Umgebungsvariablen
echo "PLUGIN_REQS=$PLUGIN_REQS" >> $GITHUB_ENV
echo "APT_PKG_LIST=$APT_PKG_LIST" >> $GITHUB_ENV
else
echo "CHANGED=false" >> $GITHUB_ENV
fi
# - name: Build collection
# run: ansible-galaxy collection build -vvv --output-path . --requirements-file requirements.txt --force
# env:
# ANSIBLE_GALAXY_API_KEY: ${{ secrets.GALAXY_API_KEY }} # Stellen Sie sicher, dass GALAXY_API_KEY in Ihren Secrets gesetzt ist
#
# - name: Publish collection
# run: ansible-galaxy collection publish --api-key ${{ secrets.GALAXY_API_KEY }} ./ji_podhead-ilohelper-*.tar.gz
# env:
# ANSIBLE_GALAXY_API_KEY: ${{ secrets.GALAXY_API_KEY }}