-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
actions: prepare workflow for flakehub tagged + ansible galaxy
- Loading branch information
Showing
2 changed files
with
90 additions
and
19 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
name: Release and Deploy collection | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
releaseanddeploy: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'mgit-at/ansible-collection-nix_unify' | ||
strategy: | ||
matrix: | ||
python-version: [3.8] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get current version | ||
id: cversion | ||
run: echo "::set-output name=version::$(grep version galaxy.yml | cut -f 2 -d ' ')" | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade ansible==2.10 | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Build Ansible Collection | ||
run: ansible-galaxy collection build . --force | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.cversion.outputs.version }} | ||
release_name: Release v${{ steps.cversion.outputs.version }} | ||
body: | | ||
Install flake from flakehub: | ||
[![FlakeHub](https://img.shields.io/endpoint?url=https://flakehub.com/f/mgit-at/nix-unify/badge)](https://flakehub.com/flake/mgit-at/nix-unify) | ||
Add nix-unify to your `flake.nix`: | ||
```nix | ||
{ | ||
inputs.nix-unify.url = "https://flakehub.com/f/mgit-at/nix-unify/*.tar.gz"; | ||
outputs = { self, nix-unify }: { | ||
# Use in your outputs | ||
}; | ||
} | ||
``` | ||
Install over Ansible Galaxy: | ||
```sh | ||
ansible-galaxy collection install mgit_at.nix_unify | ||
``` | ||
Install from the Github repositority with: | ||
```sh | ||
ansible-galaxy collection install -r requirements.yml -f | ||
``` | ||
The requirements.yml needs to have the following format and content: | ||
```yaml | ||
--- | ||
collections: | ||
- https://github.com/mgit-at/nix-unify/releases/download/v${{ steps.cversion.outputs.version }}/mgit_at-nix_unify-${{ steps.cversion.outputs.version }}.tar.gz | ||
``` | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: mgit_at-nix_unify-${{ steps.cversion.outputs.version }}.tar.gz | ||
asset_name: mgit_at-nix_unify-${{ steps.cversion.outputs.version }}.tar.gz | ||
asset_content_type: application/tar+gzip | ||
|
||
- name: Deploy Ansible collection to Galaxy | ||
run: ansible-galaxy collection publish mgit_at-nix_unify-${{ steps.cversion.outputs.version }}.tar.gz --api-key ${{ secrets.GALAXY_API_KEY }} |