-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9bbd065
commit 7e9087c
Showing
1 changed file
with
4 additions
and
82 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,88 +5,10 @@ on: | |
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'ansible-middleware/amq_streams' | ||
permissions: | ||
actions: write | ||
checks: write | ||
contents: write | ||
deployments: write | ||
packages: write | ||
pages: write | ||
outputs: | ||
tag_version: ${{ steps.get_version.outputs.TAG_VERSION }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.TRIGGERING_PAT }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
cache: 'pip' | ||
|
||
- name: Get current version | ||
id: get_version | ||
run: echo "::set-output name=TAG_VERSION::$(grep version galaxy.yml | awk -F'"' '{ print $2 }')" | ||
|
||
- name: Check if tag exists | ||
id: check_tag | ||
run: echo "::set-output name=TAG_EXISTS::$(git tag | grep ${{ steps.get_version.outputs.TAG_VERSION }})" | ||
|
||
- name: Fail if tag exists | ||
if: ${{ steps.get_version.outputs.TAG_VERSION == steps.check_tag.outputs.TAG_EXISTS }} | ||
uses: actions/github-script@v3 | ||
with: | ||
script: | | ||
core.setFailed('Release tag already exists') | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ansible-core antsibull | ||
sudo apt install -y sed hub | ||
- name: Build collection | ||
run: | | ||
ansible-galaxy collection build . | ||
- name: Create changelog and documentation | ||
uses: ansible-middleware/collection-docs-action@main | ||
with: | ||
collection_fqcn: middleware_automation.amq_streams | ||
collection_repo: ansible-middleware/amq_streams | ||
dependencies: false | ||
commit_changelog: true | ||
commit_ghpages: false | ||
changelog_release: true | ||
generate_docs: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish collection | ||
env: | ||
ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} | ||
run: | | ||
ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY | ||
- name: Create release tag | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git tag -a ${{ steps.get_version.outputs.TAG_VERSION }} -m "Release v${{ steps.get_version.outputs.TAG_VERSION }}" || true | ||
git push origin --tags | ||
- name: Publish Release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.get_version.outputs.TAG_VERSION }} | ||
files: "*.tar.gz" | ||
body_path: gh-release.md | ||
uses: ansible-middleware/github-actions/.github/workflows/release.yml@main | ||
secrets: inherit | ||
with: | ||
collection_fqcn: 'middleware_automation.amq_streams' | ||
|
||
dispatch: | ||
needs: release | ||
|