From b823c05c0a1db849e815f6292833f1a9e4bca197 Mon Sep 17 00:00:00 2001 From: Filip Szweda Date: Mon, 24 Jun 2024 14:13:52 +0200 Subject: [PATCH] Create release mechanism for the collection --- .../publish-to-ansible-galaxy/action.yaml | 23 ++++++++++++++++ .github/workflows/build-test-and-publish.yaml | 27 +++++++++++++++++++ ...upload.yaml => build-test-and-upload.yaml} | 3 ++- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/actions/publish-to-ansible-galaxy/action.yaml create mode 100644 .github/workflows/build-test-and-publish.yaml rename .github/workflows/{build-test-upload.yaml => build-test-and-upload.yaml} (96%) diff --git a/.github/actions/publish-to-ansible-galaxy/action.yaml b/.github/actions/publish-to-ansible-galaxy/action.yaml new file mode 100644 index 0000000..0d50711 --- /dev/null +++ b/.github/actions/publish-to-ansible-galaxy/action.yaml @@ -0,0 +1,23 @@ +# Copyright 2024 Dynatrace LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: publish-to-ansible-galaxy +description: Publish to Ansible Galaxy + +runs: + using: composite + steps: + - name: Publish the Ansible collection + shell: bash + run: ansible-galaxy collection publish dynatrace-oneagent* --token ${{ secrets.ANSIBLE_GALAXY_API_TOKEN }} diff --git a/.github/workflows/build-test-and-publish.yaml b/.github/workflows/build-test-and-publish.yaml new file mode 100644 index 0000000..1a330f5 --- /dev/null +++ b/.github/workflows/build-test-and-publish.yaml @@ -0,0 +1,27 @@ +# Copyright 2024 Dynatrace LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Build, test and publish +on: + push: + tags: + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - name: Build and test + uses: ./.github/workflows/build-and-test.yaml + - name: Publish to Ansible Galaxy + uses: ./.github/actions/publish-to-ansible-galaxy diff --git a/.github/workflows/build-test-upload.yaml b/.github/workflows/build-test-and-upload.yaml similarity index 96% rename from .github/workflows/build-test-upload.yaml rename to .github/workflows/build-test-and-upload.yaml index a80f830..b2c787f 100644 --- a/.github/workflows/build-test-upload.yaml +++ b/.github/workflows/build-test-and-upload.yaml @@ -15,7 +15,8 @@ name: Build, test and upload on: push: - branches: [ 'main' ] + branches: + - master workflow_dispatch: jobs: