Skip to content

Commit

Permalink
Merge pull request #3 from manala/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
nervo authored Sep 13, 2024
2 parents ac4e10b + 8956dcf commit e234dd3
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 95 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Collection
name: Release

on:
push:
branches:
- main

jobs:
collection:
name: Collection
release:
name: Release
runs-on: ubuntu-24.04
if: github.event.head_commit.message == 'Release'
steps:

- name: Notify Slack of starting
- name: Notify Slack - Starting
uses: act10ns/slack@v2
with:
status: starting
Expand All @@ -23,59 +23,57 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Create ansible galaxy token
- name: Set ansible galaxy token
run: |
cat << EOF > ./galaxy_token
token: ${{ secrets.ANSIBLE_GALAXY_TOKEN }}
EOF
- name: Env
run: |
cp .env .env.local
- name: Set up system
uses: ./.manala/github/system/setup

- name: Retrieve version from galaxy.yml
id: version
- name: Get metadata from galaxy.yml
id: metadata
uses: CumulusDS/[email protected]
with:
file: ./galaxy.yml
version: version

- name: Build Collection
- name: Build
id: build
run: |
make collection.build
make build VERBOSE=1
- name: Create artifact from collection build
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
path: ./manala-path-${{ steps.version.outputs.version }}.tar.gz
name: manala-path-${{ steps.version.outputs.version }}
path: ./manala-path-${{ steps.metadata.outputs.version }}.tar.gz
name: manala-path-${{ steps.metadata.outputs.version }}
retention-days: 1

- name: Publish Collection
- name: Publish
id: publish
run: |
make collection.publish
make publish VERBOSE=1
- name: Get Changelog Entry
- name: Get Changelog entry
id: changelog
uses: mindsers/changelog-reader-action@v2
with:
path: ./CHANGELOG.md
version: ${{ steps.version.outputs.version }}
version: ${{ steps.metadata.outputs.version }}

- name: Create Github Release
- name: Create GitHub Release
id: release
uses: ncipollo/release-action@v1
with:
name: manala-path ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.version }}
name: manala-path ${{ steps.metadata.outputs.version }}
tag: ${{ steps.metadata.outputs.version }}
body: ${{ steps.changelog.outputs.changes }}
artifacts: ./manala-path-${{ steps.version.outputs.version }}.tar.gz
artifacts: ./manala-path-${{ steps.metadata.outputs.version }}.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
skipIfReleaseExists: true

- name: Notify Slack of job status
- name: Notify Slack - Status
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
Expand Down
3 changes: 2 additions & 1 deletion .manala.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ system:
dir: /usr/share/ansible/collections/ansible_collections/manala/path
env_file:
- .env
- .env.local
- path: .env.local
required: false
git:
config: |
# Silence false positive dubious ownership errors
Expand Down
5 changes: 3 additions & 2 deletions .manala/docker/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ services:
build:
context: ..
dockerfile: docker/Dockerfile
image: manala-ansible-path:20240912125058
image: manala-ansible-path:20240913091855
volumes:
- ../..:${MANALA_DIR}
environment:
MANALA_DIR: ${MANALA_DIR}
MANALA_CACHE_DIR: ${MANALA_CACHE_DIR}
env_file:
- ../../.env
- ../../.env.local
- path: ../../.env.local
required: false
working_dir: ${MANALA_DIR}
# Use default docker bridge network
network_mode: bridge
31 changes: 17 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,24 @@ test.coverage:
--color yes
.PHONY: test.coverage

##############
# Collection #
##############
###################
# Build / Publish #
###################

MANALA_COLLECTION = manala-path-*.tar.gz
COLLECTION = manala-path-*.tar.gz

## Collection - Build ansible collection artifact
collection.build: SHELL := $(MANALA_DOCKER_SHELL)
collection.build:
rm -rf $(MANALA_COLLECTION)
ansible-galaxy collection build --force --verbose
.PHONY: collection.build
## Build - Build collection
build: SHELL := $(MANALA_DOCKER_SHELL)
build:
rm -rfv $(COLLECTION)
ansible-galaxy collection build \
$(if $(VERBOSE), --verbose) \
--force
.PHONY: build

## Collection - Publish collection
collection.publish: SHELL := $(MANALA_DOCKER_SHELL)
collection.publish:
ansible-galaxy collection publish $(MANALA_COLLECTION)
.PHONY: collection.publish
publish: SHELL := $(MANALA_DOCKER_SHELL)
publish:
ansible-galaxy collection publish $(COLLECTION) \
$(if $(VERBOSE), --verbose)
.PHONY: publish
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ See [Ansible Using collections](https://docs.ansible.com/ansible/devel/user_guid

## Use this collection

See the [examples playbook](./examples/examples.yaml).
See the [examples](examples).

## Release notes

Expand Down
42 changes: 0 additions & 42 deletions examples/examples.yaml

This file was deleted.

28 changes: 28 additions & 0 deletions examples/simple.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---

# This playbook example contains simple use cases that illustrate the basics functionality of manala.path.path module.

- name: Examples - Simple
gather_facts: false
hosts: localhost
tasks:

- name: Ensure a directory exists at path
manala.path.path:
path: /tmp/directory

- name: Ensure the specified path (file or directory) is absent
manala.path.path:
path: /tmp/file
state: absent

- name: Ensure the specified file at path contains content
manala.path.path:
path: /tmp/file_content
content: |
Hello World!
- name: Ensure the specified file at path contains rendered template content
manala.path.path:
path: /tmp/file_template
template: template.j2
2 changes: 1 addition & 1 deletion examples/template.j2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Hello : {{ 'World' }}
Hello {{ 'World' }}!
8 changes: 0 additions & 8 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ readme: README.md
authors:
- Manala <[email protected]>


### OPTIONAL but strongly recommended
# A short summary description of the collection
description: path handling
Expand Down Expand Up @@ -70,10 +69,3 @@ build_ignore:
- Makefile
- manala-path-*
- tests

# A dict controlling use of manifest directives used in building the collection artifact. The key 'directives' is a
# list of MANIFEST.in style
# L(directives,https://packaging.python.org/en/latest/guides/using-manifest-in/#manifest-in-commands). The key
# 'omit_default_directives' is a boolean that controls whether the default directives are used. Mutually exclusive
# with 'build_ignore'
# manifest: null

0 comments on commit e234dd3

Please sign in to comment.