|
5 | 5 |
|
6 | 6 | jobs: |
7 | 7 | release: |
8 | | - runs-on: ubuntu-latest |
9 | | - if: github.repository == 'ansible-middleware/common' |
10 | | - permissions: |
11 | | - actions: write |
12 | | - checks: write |
13 | | - contents: write |
14 | | - deployments: write |
15 | | - packages: write |
16 | | - pages: write |
17 | | - outputs: |
18 | | - tag_version: ${{ steps.get_version.outputs.TAG_VERSION }} |
19 | | - steps: |
20 | | - - name: Checkout code |
21 | | - uses: actions/checkout@v3 |
22 | | - with: |
23 | | - fetch-depth: 0 |
24 | | - token: ${{ secrets.TRIGGERING_PAT }} |
25 | | - |
26 | | - - name: Set up Python |
27 | | - uses: actions/setup-python@v4 |
28 | | - with: |
29 | | - python-version: "3.x" |
30 | | - cache: 'pip' |
31 | | - |
32 | | - - name: Get current version |
33 | | - id: get_version |
34 | | - run: echo "::set-output name=TAG_VERSION::$(grep version galaxy.yml | awk -F'"' '{ print $2 }')" |
35 | | - |
36 | | - - name: Check if tag exists |
37 | | - id: check_tag |
38 | | - run: echo "::set-output name=TAG_EXISTS::$(git tag | grep ${{ steps.get_version.outputs.TAG_VERSION }})" |
39 | | - |
40 | | - - name: Fail if tag exists |
41 | | - if: ${{ steps.get_version.outputs.TAG_VERSION == steps.check_tag.outputs.TAG_EXISTS }} |
42 | | - uses: actions/github-script@v3 |
43 | | - with: |
44 | | - script: | |
45 | | - core.setFailed('Release tag already exists') |
46 | | -
|
47 | | - - name: Install dependencies |
48 | | - run: | |
49 | | - python -m pip install --upgrade pip |
50 | | - pip install ansible-core antsibull |
51 | | - sudo apt install -y sed hub |
52 | | -
|
53 | | - - name: Build collection |
54 | | - run: | |
55 | | - ansible-galaxy collection build . |
56 | | -
|
57 | | - - name: Create changelog and documentation |
58 | | - uses: ansible-middleware/collection-docs-action@main |
59 | | - with: |
60 | | - collection_fqcn: middleware_automation.common |
61 | | - collection_repo: ansible-middleware/common |
62 | | - dependencies: false |
63 | | - commit_changelog: true |
64 | | - commit_ghpages: false |
65 | | - changelog_release: true |
66 | | - generate_docs: false |
67 | | - token: ${{ secrets.GITHUB_TOKEN }} |
68 | | - |
69 | | - - name: Publish collection |
70 | | - env: |
71 | | - ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} |
72 | | - run: | |
73 | | - ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY |
74 | | -
|
75 | | - - name: Create release tag |
76 | | - run: | |
77 | | - git config user.name github-actions |
78 | | - git config user.email github-actions@github.com |
79 | | - git tag -a ${{ steps.get_version.outputs.TAG_VERSION }} -m "Release v${{ steps.get_version.outputs.TAG_VERSION }}" || true |
80 | | - git push origin --tags |
81 | | -
|
82 | | - - name: Publish Release |
83 | | - uses: softprops/action-gh-release@v1 |
84 | | - env: |
85 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
86 | | - with: |
87 | | - tag_name: ${{ steps.get_version.outputs.TAG_VERSION }} |
88 | | - files: "*.tar.gz" |
89 | | - body_path: gh-release.md |
| 8 | + uses: ansible-middleware/github-actions/.github/workflows/release.yml@main |
| 9 | + secrets: inherit |
| 10 | + with: |
| 11 | + collection_fqcn: 'middleware_automation.common' |
90 | 12 |
|
91 | 13 | dispatch: |
92 | 14 | needs: release |
|
0 commit comments