publish development releases and artifacts

Signed-off-by: Paweł Krupa (paulfantom) <pawel@krupa.net.pl>
This commit is contained in:
Paweł Krupa (paulfantom) 2022-09-23 14:08:30 +02:00
parent a1e10429f7
commit f26bb1b100
3 changed files with 94 additions and 3 deletions

89
.github/workflows/publish_latest.yml vendored Normal file
View file

@ -0,0 +1,89 @@
name: Publish Collection
on:
push:
branches:
- main
release:
types:
- 'published'
env:
python-version: 3.9
jobs:
publish-latest:
if: github.event_name == 'push'
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ansible_collections/prometheus/prometheus
steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/prometheus/prometheus
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ env.python-version }}
- name: Install ansible-base (devel)
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
- name: Build the collection
run: ansible-galaxy collection build
- name: Rename the build artifact
run: mv prometheus-prometheus-*.tar.gz prometheus-community-prometheus-latest.tar.gz
# Moving the tag leaves an orphan artifact. Just changing the artifact doesn't move the tag.
- name: Delete latest tag and release
uses: dev-drprasad/delete-tag-and-release@v0.1.2
with:
delete_release: true
tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload files to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ansible_collections/prometheus/prometheus/prometheus-community-prometheus-latest.tar.gz
asset_name: prometheus-community-prometheus-latest.tar.gz
body: "Development release"
tag: latest
overwrite: true
publish-tagged:
if: github.event_name == 'release'
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ansible_collections/prometheus/prometheus
steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/prometheus/prometheus
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ env.python-version }}
- name: Install ansible-base (devel)
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
- name: Build the collection
run: ansible-galaxy collection build
- name: Upload files to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ansible_collections/prometheus/prometheus/prometheus-community-prometheus-*.tar.gz
file_glob: true
tag: ${{ github.ref }}
overwrite: true

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.tar.gz

View file

@ -2,9 +2,9 @@
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: community
namespace: prometheus
name: prometheus
version: 1.0.0
version: 0.0.1
readme: README.md
authors:
@ -14,12 +14,13 @@ authors:
description: your collection description
license_file: LICENSE
tags:
- observability
- o11y
- monitoring
- prometheus
- metrics
- alerts
- alerting
- molecule
- cloud
# Collections that this collection requires to be installed for it to be usable. The key of the dict is the