Skip to content

Commit

Permalink
Add release action
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak committed Oct 31, 2023
1 parent 4f1f6bb commit 947f25d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Release
on:
pull_request:
branches:
- master

defaults:
run:
working-directory: 'nephelaiio.mongos'

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
with:
path: 'nephelaiio.mongos'

- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Update ubuntu repositories
run: sudo apt-get update

- name: Install make
run: sudo apt-get install -y make

- name: Release collection
run: make release
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ GITHUB_REPO = $$(echo ${GITHUB_REPOSITORY} | cut -d/ -f 2)
REQUIREMENTS = requirements.yml
ROLE_DIR = roles
ROLE_FILE = roles.yml
COLLECTION_NAMESPACE = $$(yq '.namespace' < galaxy.yml)
COLLECTION_NAME = $$(yq '.name' < galaxy.yml)

all: install version lint test

Expand All @@ -17,12 +19,13 @@ test: lint

install:
@type poetry >/dev/null || pip3 install poetry
@type yq || sudo apt-get install -y yq
@poetry install

lint: install
poetry run yamllint .

requirements:
requirements: install
@rm -rf ${ROLE_DIR}/*
@poetry run ansible-galaxy role install \
--force --no-deps \
Expand All @@ -43,8 +46,12 @@ ignore:
clean: destroy reset
@poetry env remove $$(which python) >/dev/null 2>&1 || exit 0

publish:
@echo not implemented yet || exit 1
publish: build
@echo publishing repository ${GITHUB_REPOSITORY}
@echo GITHUB_ORGANIZATION=${GITHUB_ORG}
@echo GITHUB_REPOSITORY=${GITHUB_REPO}
@find ./ -name "${COLLECTION_NAMESPACE}-${COLLECTION_NAME}.*.tar.gz" | \
xargs poetry run ansible-galaxy collection publish --api-key ${GALAXY_API_KEY}

version:
@poetry run molecule --version
Expand Down
8 changes: 4 additions & 4 deletions playbooks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
- name: Deploy shard1 cluster
ansible.builtin.import_playbook: nephelaiio.mongodb.shard
vars:
mongos_replicaset_shard_name: shard1
mongodb_shard: mongodb_shard1
mongos_replicaset_shard_name: "{{ mongodb_shard1_name | default('shard1') }}"
mongodb_shard: "{{ mongodb_shard1_group | default('mongodb_shard1') }}"

- name: Deploy mongos servers
ansible.builtin.import_playbook: nephelaiio.mongodb.mongos
vars:
mongodb_shard_clusters:
- name: shard1
group: mongodb_shard1
- name: "{{ mongodb_shard1_name | default('shard1') }}"
group: "{{ mongodb_shard1_group | default('mongodb_shard1') }}"

0 comments on commit 947f25d

Please sign in to comment.