|
1 | 1 | name: Publish to Ansible Galaxy |
2 | 2 |
|
3 | 3 | on: |
4 | | - release: |
5 | | - types: published |
| 4 | + push: |
6 | 5 | workflow_dispatch: |
7 | 6 |
|
8 | 7 | jobs: |
9 | 8 | publish: |
10 | 9 | environment: publish |
11 | 10 | runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + version: ${{ steps.build.outputs.version }} |
12 | 13 |
|
13 | 14 | steps: |
14 | 15 | - name: Checkout code |
15 | 16 | uses: actions/checkout@v4 |
16 | 17 |
|
17 | 18 | - name: Build |
18 | | - run: ansible-galaxy collection build |
| 19 | + id: build |
| 20 | + run: | |
| 21 | + OUTPUT=$(ansible-galaxy collection build) |
| 22 | + echo "$OUTPUT" |
| 23 | + COLLECTION_PATH=$(echo "$OUTPUT" | grep -o '/[^ ]*\.tar\.gz') |
| 24 | + VERSION=$(echo "$COLLECTION_PATH" | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.tar\.gz' | sed 's/\.tar\.gz//') |
| 25 | + echo "collection_path=$COLLECTION_PATH" >> $GITHUB_OUTPUT |
| 26 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 27 | + echo "Collection path: $COLLECTION_PATH" |
| 28 | + echo "Collection version: $VERSION" |
19 | 29 |
|
20 | | - - name: Publish to Ansible Galaxy |
21 | | - run: ansible-galaxy collection publish *.tar.gz --api-key ${{ secrets.ANSIBLE_GALAXY_TOKEN }} |
| 30 | + - run: | |
| 31 | + echo "${{ steps.build.outputs.collection_path }}" |
22 | 32 |
|
23 | | - - name: Upload Artifact |
24 | | - |
25 | | - with: |
26 | | - name: ansible-dvls-collection |
27 | | - path: '*.tar.gz' |
| 33 | + # - name: Publish to Ansible Galaxy |
| 34 | + # run: ansible-galaxy collection publish ${{ steps.build.outputs.collection_path }} --api-key ${{ secrets.ANSIBLE_GALAXY_TOKEN }} |
| 35 | + |
| 36 | + # - name: Upload Artifact |
| 37 | + |
| 38 | + # with: |
| 39 | + # name: ansible-dvls-collection |
| 40 | + # path: ${{ steps.build.outputs.collection_path }} |
| 41 | + |
| 42 | + create-release: |
| 43 | + name: Create release |
| 44 | + runs-on: ubuntu-latest |
| 45 | + needs: publish |
| 46 | + |
| 47 | + steps: |
| 48 | + - run: | |
| 49 | + echo "${{ needs.publish.outputs.version }}" |
| 50 | +
|
| 51 | + # - name: Check out ${{ github.repository }} |
| 52 | + # uses: actions/checkout@v4 |
| 53 | + # with: |
| 54 | + # fetch-depth: 0 # fetch all tags for the set version step |
| 55 | + |
| 56 | + # - name: Create release |
| 57 | + # id: create-release |
| 58 | + # uses: devolutions/actions/create-release@v1 |
| 59 | + # with: |
| 60 | + # github_token: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + # tag: v${{ needs.publish.outputs.version }} |
0 commit comments