Skip to content

Commit

Permalink
Pauses workflow for PR review & then publish
Browse files Browse the repository at this point in the history
Based on the feedback this PR edits for the following:

Adds a job to pause the workflow till the pr is reviewed and merged.
Adds publish to PyPI job in this worklflow.
Adds git tag job in this workflow.
  • Loading branch information
anweshadas committed Jan 16, 2024
1 parent a223efb commit 1d7688f
Showing 1 changed file with 62 additions and 3 deletions.
65 changes: 62 additions & 3 deletions .github/workflows/ansible-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ jobs:
git config --global user.name "Github Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Run the playbook according to the current release process

# Run the playbook according to the current release process

- name: Test building a release with the defaults
- name: Building a release with the defaults
working-directory: antsibull
run: >-
ansible-playbook -vv playbooks/build-single-release.yaml
Expand All @@ -74,6 +73,12 @@ jobs:
# Make result better readable
ANSIBLE_CALLBACK_RESULT_FORMAT: yaml

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: sdist-and-wheel
path: antsibull/build/ansible-*.*

- name: Commit ansible-build-data and push the changes to github
working-directory: 'antsibull/build/ansible-build-data/${{ inputs.ansible-major-version }}'
run: |
Expand All @@ -91,3 +96,57 @@ jobs:
--head "publish-${{ inputs.ansible-version }}"
--title "${{ env.CI_COMMIT_MESSAGE }}"
--body "${{ env.CI_COMMIT_MESSAGE }}"
# publish job downloads the arifacts and publish it to PyPI

prreview:
runs-on: ubuntu-latest
environment: pypirelease
needs: build
steps:
- name: Pause for the PR review
run: echo 'Review Done'

publish:
needs: [build, prreview]
name: 'Upload Ansible (${{ inputs.ansible-version }}) to PyPI'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/ansible
permissions:
id-token: write

steps:

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: sdist-and-wheel
path: dist/

- name: Upload Ansible sdist and wheel to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

# git-tag job creates the git tag

git-tag:
needs: publish
name: 'Creates git tag for Ansible (${{ inputs.ansible-version }})'
runs-on: ubuntu-latest
permissions:
contents: write

steps:

- name: Check out ansible-build-data
uses: actions/checkout@v3

- name: Create git tag
working-directory: ansible-build-data
run: |
git config --global user.name "Github Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "${ANSIBLE_VERSION}" -m "Ansible ${ANSIBLE_VERSION}: Changelog, Porting Guide and Dependent Collection Details"
git push origin ${ANSIBLE_VERSION}}

0 comments on commit 1d7688f

Please sign in to comment.