mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 00:08:44 -03:30
Fix galaxy publishing (#15233)
- switch to galaxy search API for determining if the version we want to publish already exist - switch from github action variable to env var for easier copy and paste testing
This commit is contained in:
13
.github/workflows/promote.yml
vendored
13
.github/workflows/promote.yml
vendored
@@ -60,15 +60,18 @@ jobs:
|
|||||||
COLLECTION_VERSION: ${{ env.TAG_NAME }}
|
COLLECTION_VERSION: ${{ env.TAG_NAME }}
|
||||||
COLLECTION_TEMPLATE_VERSION: true
|
COLLECTION_TEMPLATE_VERSION: true
|
||||||
run: |
|
run: |
|
||||||
|
sudo apt-get install jq
|
||||||
make build_collection
|
make build_collection
|
||||||
curl_with_redirects=$(curl --head -sLw '%{http_code}' https://galaxy.ansible.com/download/${{ env.collection_namespace }}-awx-${{ env.TAG_NAME }}.tar.gz | tail -1)
|
count=$(curl -s https://galaxy.ansible.com/api/v3/plugin/ansible/search/collection-versions/\?namespace\=${COLLECTION_NAMESPACE}\&name\=awx\&version\=${COLLECTION_VERSION} | jq .meta.count)
|
||||||
curl_without_redirects=$(curl --head -sw '%{http_code}' https://galaxy.ansible.com/download/${{ env.collection_namespace }}-awx-${{ env.TAG_NAME }}.tar.gz | tail -1)
|
if [[ "$count" == "1" ]]; then
|
||||||
if [[ "$curl_with_redirects" == "302" ]] || [[ "$curl_without_redirects" == "302" ]]; then
|
|
||||||
echo "Galaxy release already done";
|
echo "Galaxy release already done";
|
||||||
else
|
elif [[ "$count" == "0" ]]; then
|
||||||
ansible-galaxy collection publish \
|
ansible-galaxy collection publish \
|
||||||
--token=${{ secrets.GALAXY_TOKEN }} \
|
--token=${{ secrets.GALAXY_TOKEN }} \
|
||||||
awx_collection_build/${{ env.collection_namespace }}-awx-${{ env.TAG_NAME }}.tar.gz;
|
awx_collection_build/${COLLECTION_NAMESPACE}-awx-${COLLECTION_VERSION}.tar.gz;
|
||||||
|
else
|
||||||
|
echo "Unexpected count from galaxy search: $count";
|
||||||
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Set official pypi info
|
- name: Set official pypi info
|
||||||
|
|||||||
Reference in New Issue
Block a user