Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial (Github Actions) Workflows for Ansible Community Package release #265

Merged
merged 37 commits into from Feb 6, 2024
Merged
Changes from 35 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
abbffbb
Adds the manual triggering to release
anweshadas Jun 27, 2023
411a065
Adds the name of the GHA as the filename
anweshadas Jun 27, 2023
0d1f06a
Adds inputs section and removes matrix
anweshadas Jun 28, 2023
d571661
Ignore GHA checkout of ansible-build-data
anweshadas Jun 28, 2023
1a9d4ef
Adds steps for creating PR to ansible-build-data
anweshadas Jun 29, 2023
b41ffa7
Changes working directory to ansible-build-data
anweshadas Jun 29, 2023
a94c419
Adds steps to check the current directory
anweshadas Jun 29, 2023
37a7c31
Adds antsibull/build/ansible-build-data as working dir
anweshadas Jun 29, 2023
e288b4c
Removes antsibull/build/ansible-build-data directory
anweshadas Jun 29, 2023
e5661fc
Adds git remote and git push command
anweshadas Jun 29, 2023
04cf348
Creating PR on ansible-build-data
anweshadas Jul 3, 2023
3ae93b8
Adds correct working directory
anweshadas Jul 3, 2023
d41a08e
Corrects the branch name
anweshadas Jul 3, 2023
aa2ea1d
Adds initial workflow to upload to PyPI
anweshadas Jul 4, 2023
9614889
Adds the required files in git
anweshadas Jul 4, 2023
1b3d10a
Adds tarball to sdist directory
anweshadas Jul 4, 2023
5ab2761
Updates the target branch as main
anweshadas Jul 14, 2023
2d35dd0
Updates based on PR feedback
anweshadas Nov 29, 2023
9bac8f9
Uses playbook and adds git tag
anweshadas Nov 29, 2023
3e2fb39
Updates based on the PR feedback
anweshadas Nov 29, 2023
3f5c471
Cleans up gha workflows
anweshadas Dec 3, 2023
bb8c345
Adds code to create git tag
anweshadas Dec 3, 2023
b697a3f
Reformats the input
anweshadas Dec 3, 2023
f8cc4d0
Cleans up based on feedback
anweshadas Dec 9, 2023
2c5cadd
Fixes based on testing
anweshadas Dec 20, 2023
0b2ab50
Updates pypi configuration for release
anweshadas Dec 20, 2023
2105ec0
Edits based on feedback
anweshadas Dec 22, 2023
c668413
Edits based on the feedback
anweshadas Jan 2, 2024
ac90bcf
Edits based on the Feedback.
anweshadas Jan 12, 2024
a223efb
Edits following the feedback
anweshadas Jan 15, 2024
1d7688f
Pauses workflow for PR review & then publish
anweshadas Jan 16, 2024
d81a274
Uses pypirelease environment
anweshadas Jan 24, 2024
40d2c16
Removes extra workflow file
anweshadas Jan 24, 2024
7db6bc9
Updates based on the PR review feedback
anweshadas Jan 27, 2024
efe5b10
Uses pypi environment
anweshadas Jan 29, 2024
3a7ad86
Edits based on the feedback hacking with Felix
anweshadas Feb 5, 2024
8f99dd8
Apply suggestions from code review.
felixfontein Feb 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
150 changes: 150 additions & 0 deletions .github/workflows/ansible-release.yml
anweshadas marked this conversation as resolved.
Show resolved Hide resolved
@@ -0,0 +1,150 @@
name: ansible-release
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
on:
workflow_dispatch:
inputs:
ansible-version:
description: >-
Release Version. Example : 11.1.0
required: true
ansible-major-version:
description: Example 11
required: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This input isn't really needed. Instead, calculate the major version from ansible-version and set that as a step/job output for reuse in runtime.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in the beginning of the feedback loop this will be a future improvement.

env:
CI_COMMIT_MESSAGE: >-
Ansible ${{ inputs.ansible-version }}:
Dependencies, changelog and porting guide
ANSIBLE_VERSION: ${{ inputs.ansible-version }}

jobs:
build:
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
name: Build Ansible (${{ inputs.ansible-version }})
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write

steps:
- name: Check out antsibull
uses: actions/checkout@v3
with:
repository: ansible-community/antsibull
ref: main
path: antsibull

- name: Pre-create build directory
run: mkdir -p antsibull/build
felixfontein marked this conversation as resolved.
Show resolved Hide resolved

# This is where the antsibull build-release role expects it by default
- name: Check out ansible-build-data under antsibull build directory
uses: actions/checkout@v3
with:
path: antsibull/build/ansible-build-data

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
working-directory: antsibull
run: |
python3 -m pip install ansible-core
python3 -m pip install antsibull
ansible-galaxy collection install community.general
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
felixfontein marked this conversation as resolved.
Show resolved Hide resolved

- name: Checking out to a new branch
working-directory: antsibull/build/ansible-build-data
run: |
git checkout -b "publish-${ANSIBLE_VERSION}"

- name: Setting the user details
run: |
git config --global user.name "Github Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
anweshadas marked this conversation as resolved.
Show resolved Hide resolved

# Run the playbook according to the current release process

- name: Building a release with the defaults
working-directory: antsibull
run: >-
ansible-playbook -vv playbooks/build-single-release.yaml
webknjaz marked this conversation as resolved.
Show resolved Hide resolved
-e antsibull_data_reset=false
-e "antsibull_ansible_version=${ANSIBLE_VERSION}"

env:
# Make result better readable
ANSIBLE_CALLBACK_RESULT_FORMAT: yaml

felixfontein marked this conversation as resolved.
Show resolved Hide resolved
- 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: |
git add *.rst *.build *.deps *.yaml *.in validate-tags-ignores
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
git push origin "publish-${ANSIBLE_VERSION}"

- name: Create PR to the ansible-build-data
working-directory: antsibull/build/ansible-build-data
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >-
gh pr create
--base main
--head "publish-${{ inputs.ansible-version }}"
--title "Release Ansible v${{ inputs.ansible-version }}"
--body "${{ env.CI_COMMIT_MESSAGE }}"
felixfontein marked this conversation as resolved.
Show resolved Hide resolved

# publish job downloads the arifacts and publish it to PyPI

publish:
needs: build
name: Upload Ansible (${{ inputs.ansible-version }}) to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/ansible/${{ inputs.ansible-version }}
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
anweshadas marked this conversation as resolved.
Show resolved Hide resolved
with:
ref: ${{ github.event.repository.default_branch }}

- name: Create git tag
anweshadas marked this conversation as resolved.
Show resolved Hide resolved
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}}
felixfontein marked this conversation as resolved.
Show resolved Hide resolved

webknjaz marked this conversation as resolved.
Show resolved Hide resolved