1.1.1 #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# This workflow action will run pre-commit, which will execute ansible and yaml linting | |
# See .pre-commit-config.yaml for what hooks are executed | |
name: Release | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
pre-commit: | |
uses: redhat-cop/infra.leapp/.github/workflows/pre-commit.yml@main | |
sanity: | |
uses: redhat-cop/infra.leapp/.github/workflows/ansible-test.yml@main | |
prechecks: | |
needs: | |
- pre-commit | |
- sanity | |
runs-on: ubuntu-latest | |
steps: | |
- run: >- | |
python -c "assert set([ | |
'${{ needs.pre-commit.result }}', | |
'${{ needs.sanity.result }}', | |
]) == {'success'}" | |
infra_release: | |
needs: | |
- prechecks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Ansible | |
run: pip install --upgrade ansible-core | |
- name: Update version in galaxy.yml | |
run: sed -i 's/version:.*$/version:{{:dumb_space_issue:}}${{ github.ref_name }}/' galaxy.yml; sed -i 's/{{:dumb_space_issue:}}/ /' galaxy.yml | |
- name: Build collection | |
run: ansible-galaxy collection build -vvv | |
shell: bash | |
working-directory: ${{ vars.GITHUB_PATH }} | |
- name: Get tar name | |
run: echo "tar_file=$(ls | grep '.tar')" >> $GITHUB_OUTPUT | |
id: build | |
- name: Get version | |
run: echo "NUM=$(cat galaxy.yml | grep version | cut -d ':' -f 2 | awk '{print $1}')" >> $GITHUB_OUTPUT | |
id: vers | |
- name: Install collection | |
run: ansible-galaxy collection install ./infra-leapp-${{ steps.vers.outputs.NUM }}.tar.gz -p /home/runner/collections | |
shell: bash | |
working-directory: ${{ vars.GITHUB_PATH }} | |
- name: Publish to galaxy | |
run: ansible-galaxy collection publish --api-key=${{ secrets.GALAXY_INFRA_KEY }} ${{ steps.build.outputs.tar_file }} | |
- name: Publish to Automation Hub | |
run: | | |
cat << EOF > ansible.cfg | |
[galaxy] | |
server_list = rh_automation_hub | |
[galaxy_server.rh_automation_hub] | |
url=https://cloud.redhat.com/api/automation-hub/ | |
auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token | |
token=${{ secrets.CONSOLE_API_KEY }} | |
EOF | |
ansible-galaxy collection publish ${{ steps.build.outputs.tar_file }} | |
rm ansible.cfg | |
- name: Upload files to tag | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ steps.build.outputs.tar_file }} | |
tag: ${{ github.ref }} | |
overwrite: true | |
changelog: | |
needs: | |
- infra_release | |
runs-on: ubuntu-latest | |
env: | |
ANSIBLE_FORCE_COLOR: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Ansible | |
run: pip install --upgrade ansible-core antsibull-changelog | |
- name: Update version in galaxy.yml | |
run: sed -i 's/version:.*$/version:{{:dumb_space_issue:}}${{ github.ref_name }}/' galaxy.yml; sed -i 's/{{:dumb_space_issue:}}/ /' galaxy.yml | |
- name: Run changelog | |
run: antsibull-changelog release --verbose --version ${{ github.ref_name }} | |
- name: Create Pull Request | |
id: prcreate | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: Update changelog ${{ github.ref_name }} | |
committer: GitHub <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
signoff: false | |
base: main | |
branch: changelog-patches | |
delete-branch: true | |
title: '[RELEASE] Update changelog ${{ github.ref_name }}' | |
body: | | |
Update changelog | |
- Updated with changelog for release ${{ github.ref_name }} | |
- Auto-generated by [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request | |
labels: | | |
changelog | |
automated pr | |
draft: false | |
... |