From 62ed93f1cd3cdedbc9263b24df570462838ce33e Mon Sep 17 00:00:00 2001 From: Anwesha Das Date: Wed, 29 Nov 2023 19:38:44 +0100 Subject: [PATCH] Uses playbook and adds git tag --- .github/workflows/ansible-release.yml | 47 +++++++++----------------- .github/workflows/upload-to-pypi.yml | 48 +++++++++++---------------- 2 files changed, 34 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ansible-release.yml b/.github/workflows/ansible-release.yml index 9acc3b3121..1ffcced738 100644 --- a/.github/workflows/ansible-release.yml +++ b/.github/workflows/ansible-release.yml @@ -2,19 +2,20 @@ name: ansible-release on: workflow_dispatch: inputs: - ansible_version: - description: 'Release Version. Example : 11.1.0' + ansible-version: + description: >- + Release Version. Example : 11.1.0 required: true - ansible_major_version: - description: 'Exmaple 11' + ansible-major-version: + description: Example 11 required: true env: - CI_COMMIT_MESSAGE: 'Ansible "${{ inputs.ansible_version }}": Dependencies, changelog and porting guide' + CI_COMMIT_MESSAGE: 'Ansible "${{ inputs.ansible-version }}": Dependencies, changelog and porting guide' jobs: build: - name: 'Build Ansible community distribution (${{ inputs.ansible_version }})' + name: 'Build Ansible community distribution (${{ inputs.ansible-version }})' runs-on: ubuntu-latest permissions: pull-requests: write @@ -29,20 +30,6 @@ jobs: ref: main path: antsibull - - name: Check out antsibull-core - uses: actions/checkout@v3 - with: - repository: ansible-community/antsibull-core - ref: main - path: antsibull-core - - - name: Check out antsibull-changelog - uses: actions/checkout@v3 - with: - repository: ansible-community/antsibull-changelog - ref: main - path: antsibull-changelog - - name: Pre-create build directory run: mkdir -p antsibull/build @@ -65,12 +52,12 @@ jobs: run: | python3 -m pip install --upgrade pip python3 -m pip install ansible-core antsibull - ansible-galaxy collection install 'git+https://github.com/ansible-collections/community.general.git' + ansible-galaxy collection install community.general - name: Checking out to a new branch & setting the user details run: | cd antsibull/build/ansible-build-data - git checkout -b "publish-${{ inputs.ansible_version }}" + git checkout -b "publish-${{ inputs.ansible-version }}" git config --global user.name "${{github.actor}}" git config --global user.email "${{github.actor}}@users.noreply.github.com" @@ -81,9 +68,9 @@ jobs: run: | ansible-playbook -vv playbooks/build-single-release.yaml \ -e antsibull_data_reset=false \ - -e 'antsibull_ansible_version="${{ inputs.ansible_version }}"' \ - -e 'antsibull_data_dir="{{ antsibull_data_git_dir }}/${{ inputs.ansible_major_version }}"' \ - -e 'antsibull_build_file="ansible-${{ inputs.ansible_major_version }}.build"' + -e 'antsibull_ansible_version="${{ inputs.ansible-version }}"' \ + -e 'antsibull_data_dir="{{ antsibull_data_git_dir }}/${{ inputs.ansible-major-version }}"' \ + -e 'antsibull_build_file="ansible-${{ inputs.ansible-major-version }}.build"' env: # Make result better readable @@ -93,22 +80,18 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - cd "antsibull/build/ansible-build-data/${{ inputs.ansible_major_version }}" + cd "antsibull/build/ansible-build-data/${{ inputs.ansible-major-version }}" git add *.rst *.build *.deps *.yaml *.in validate-tags-ignores git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}" - git push origin "publish-${{ inputs.ansible_version }}" + git push origin "publish-${{ inputs.ansible-version }}" - name: Create PR to the ansible-build-data env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd antsibull/build/ansible-build-data - gh pr create -B main -H "publish-${{ inputs.ansible_version }}" --title "${{ env.CI_COMMIT_MESSAGE }}" --body "${{ env.CI_COMMIT_MESSAGE }}" - + gh pr create -B main -H "publish-${{ inputs.ansible-version }}" --title "${{ env.CI_COMMIT_MESSAGE }}" --body "${{ env.CI_COMMIT_MESSAGE }}" -# Create PR -# Run the docs build -# upload to PyPI # Create the tag diff --git a/.github/workflows/upload-to-pypi.yml b/.github/workflows/upload-to-pypi.yml index 31e4647364..e8554e3113 100644 --- a/.github/workflows/upload-to-pypi.yml +++ b/.github/workflows/upload-to-pypi.yml @@ -2,21 +2,21 @@ name: Upload-ansible-tarball-pypi on: workflow_dispatch: inputs: - ansible_version: + ansible-version: description: 'Release Version. Example : 11.1.0' required: true - ansible_major_version: + ansible-major-version: description: 'Exmaple 11' required: true env: - BUILD_DATA_DIR: "antsibull/build/ansible-build-data/${{ inputs.ansible_major_version }}" - BUILDFILE: "ansible-${{ inputs.ansible_major_version }}.build" - DEPSFILE: "ansible-${{ inputs.ansible_version }}.deps" + BUILD_DATA_DIR: "antsibull/build/ansible-build-data/${{ inputs.ansible-major-version }}" + BUILDFILE: "ansible-${{ inputs.ansible-major-version }}.build" + DEPSFILE: "ansible-${{ inputs.ansible-version }}.deps" jobs: publish: - name: 'Upload Ansible community distribution (${{ inputs.ansible_version }}) to PyPI' + name: 'Upload Ansible community distribution (${{ inputs.ansible-version }}) to PyPI' runs-on: ubuntu-latest environment: name: release @@ -32,24 +32,10 @@ jobs: ref: main path: antsibull - - name: Check out antsibull-core - uses: actions/checkout@v3 - with: - repository: ansible-community/antsibull-core - ref: main - path: antsibull-core - - - name: Check out antsibull-changelog - uses: actions/checkout@v3 - with: - repository: ansible-community/antsibull-changelog - ref: main - path: antsibull-changelog - - name: Pre-create sdist directory + - name: Pre-create build directory run: | mkdir -p antsibull/build - mkdir -p antsibull/sdist # We need to checkout the docs repo here @@ -70,23 +56,27 @@ jobs: run: | python3 -m pip install --upgrade pip python3 -m pip install ansible-core antsibull - ansible-galaxy collection install 'git+https://github.com/ansible-collections/community.general.git' + ansible-galaxy collection install community.general - - name: Create sdist dir using the deps file created in the ansible-build-data Release PR + - name: Create sdist and wheel using the deps file created in the ansible-build-data Release PR + working-directory: antsibull run: | - antsibull-build rebuild-single "${{ inputs.ansible_version }}" --data-dir "${BUILD_DATA_DIR}" --build-file "${BUILDFILE}" --sdist-dir antsibull/dist --debian + ansible-playbook -vv playbooks/build-single-release.yaml -e 'antsibull_ansible-version="${{ inputs.ansible-version }}"' -e antsibull_data_reset=false - - name: Upload Ansible sdist to PyPI + - name: Upload Ansible sdist and wheel to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ - packages-dir: antsibull/sdist + packages-dir: antsibull/build + + - name: Create git tag + working-directory: antsibull/build/ansible-build-data + run: | + git tag -a ${{ inputs.ansible-version }} -m "Ansible ${{ inputs.ansible-version }}: Changelog, Porting Guide and Dependent Collection Details" + git push origin ${{ inputs.ansible-version }} -# Create PR -# Run the docs build -# upload to PyPI # Create the tag