From f26bb1b100a88ec4d6ea0807df79239941a0af98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Krupa=20=28paulfantom=29?= Date: Fri, 23 Sep 2022 14:08:30 +0200 Subject: [PATCH] publish development releases and artifacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Krupa (paulfantom) --- .github/workflows/publish_latest.yml | 89 ++++++++++++++++++++++++++++ .gitignore | 1 + galaxy.yml | 7 ++- 3 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish_latest.yml create mode 100644 .gitignore diff --git a/.github/workflows/publish_latest.yml b/.github/workflows/publish_latest.yml new file mode 100644 index 00000000..82640893 --- /dev/null +++ b/.github/workflows/publish_latest.yml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..335ec957 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.tar.gz diff --git a/galaxy.yml b/galaxy.yml index 017d789f..1e0d94e6 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -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