-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (54 loc) · 2.28 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
name: Release and Deploy collection
on:
workflow_dispatch:
jobs:
releaseanddeploy:
runs-on: ubuntu-latest
if: github.repository == 'mgit-at/ansible-collection-mgssl'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run ansible-test
uses: ./.github/workflows/ansible-test.yml@main
- name: Get current version
id: cversion
run: echo "::set-output name=version::$(grep version galaxy.yml | cut -f 2 -d ' ')"
- 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: |
![Release and Deploy collection](https://github.com/mgit-at/ansible-collection-mgssl/workflows/Release%20and%20Deploy%20collection/badge.svg)
Install over Ansible Galaxy:
```sh
ansible-galaxy collection install mgit_at.mgssl
```
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/ansible-collection-mgssl/releases/download/v${{ steps.cversion.outputs.version }}/mgit_at-mgssl-${{ 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-mgssl-${{ steps.cversion.outputs.version }}.tar.gz
asset_name: mgit_at-mgssl-${{ 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-mgssl-${{ steps.cversion.outputs.version }}.tar.gz --api-key ${{ secrets.GALAXY_API_KEY }}