Updated the curl command #45
This file contains hidden or 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
| name: Release collection to Red Hat Automation Hub (TEST ONLY) | |
| on: | |
| push: | |
| branches: | |
| - token_based_publish | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install ansible-core | |
| run: pip install ansible-core | |
| - name: Build Ansible collection | |
| run: ansible-galaxy collection build --force | |
| - name: Get access token from sso.redhat.com | |
| id: get_token | |
| run: | | |
| response=$(curl 'https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token' \ | |
| --data-urlencode 'grant_type=client_credentials' \ | |
| --data-urlencode 'client_id=88bb9cac-3213-4906-9b28-97f1c4970574' \ | |
| --data-urlencode 'client_secret=Gn64GXQq0e6jgjkSOy4K7TAEbkKAXV9y' \ | |
| --data-urlencode 'scope=openid api.iam.service_accounts') | |
| access_token=$(echo "$response" | jq -r '.access_token') | |
| echo "access_token=$access_token" >> $GITHUB_OUTPUT | |
| - name: Publish to Red Hat Automation Hub | |
| run: | | |
| FILE=$(ls ./*.tar.gz | head -n 1) | |
| ansible-galaxy collection publish "$FILE" \ | |
| --server https://console.redhat.com/api/automation-hub/content/vmware.alb \ | |
| --token ${{ steps.get_token.outputs.access_token }} |