Skip to content

Commit

Permalink
Uses playbook and adds git tag
Browse files Browse the repository at this point in the history
  • Loading branch information
anweshadas committed Nov 29, 2023
1 parent d69a67e commit 62ed93f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 61 deletions.
47 changes: 15 additions & 32 deletions .github/workflows/ansible-release.yml
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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


Expand Down
48 changes: 19 additions & 29 deletions .github/workflows/upload-to-pypi.yml
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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


Expand Down

0 comments on commit 62ed93f

Please sign in to comment.