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 implementation of the eclipse_bluechi.bluechi collection #1

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
exclude_paths:
- .github
- changelogs
- inventory.yml
skip_list:
- galaxy[no-changelog]
...
18 changes: 18 additions & 0 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Ansible Lint
on:
- push
- pull_request
- workflow_call

jobs:
ansible-lint:
name: Ansible Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run ansible-lint
uses: ansible/ansible-lint@main
15 changes: 15 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CodeSpell

on:
- push
- pull_request
- workflow_call

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: codespell-project/actions-codespell@master
115 changes: 115 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
name: Release

on:
release:
types:
- published

jobs:
ansible-lint:
uses: eclipse-bluechi/bluechi-ansible-collection/.github/workflows/ansible-lint.yml@main
codespell:
uses: eclipse-bluechi/bluechi-ansible-collection/.github/workflows/codespell.yml@main
prechecks:
needs:
- ansible-lint
- codespell
runs-on: ubuntu-latest
steps:
- run: >-
python -c "assert set([
'${{ needs.ansible-lint.result }}',
'${{ needs.codespell.result }}',
]) == {'success'}"
release:
needs:
- prechecks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- 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-lvm_snapshots-${{ 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.ANSIBLE_GALAXY_API_TOKEN }} ${{ steps.build.outputs.tar_file }}

- 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:
- release
runs-on: ubuntu-latest
env:
ANSIBLE_FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4

- 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
...
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
inventory.yml
ansible.cfg
4 changes: 4 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rules:
indentation:
spaces: 2
indent-sequences: false
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contributing

Thank you for your interest in contributing to the Eclipse BlueChi Ansible Collection.
All we ask is that contributors please observe the [Ansible Community Guidelines](https://docs.ansible.com/ansible/devel/community/index.html)
and follow the [Ansible Collections Contributor Guide](https://docs.ansible.com/ansible/devel/community/contributions_collections.html).
We look forward to reviewing your pull request.

Everyone is invited to participate.
We welcome first timers as well as experienced open source contributors.
If you are unsure how to get started with your contribution,
open a [new issue](https://github.com/eclipse-bluechi/bluechi-ansible-collection/issues/new/choose) explaining what you want to do and we'll do our best to help!
Loading