chore(deps): update dependency community.docker to v5 (#119) #641
This file contains hidden or 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
| name: Main | |
| on: | |
| push: | |
| branches: [main] | |
| tags: [v*.*.*] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| env: | |
| ANSIBLE_COLLECTIONS_PATH: ~/.ansible/collections | |
| ANSIBLE_HOME: ~/.ansible | |
| MOLECULE_PARALLEL: "1" | |
| PY_COLORS: "1" | |
| jobs: | |
| lint-py: | |
| name: Lint Python code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Install project | |
| run: uv sync --frozen | |
| - name: Lint code | |
| run: make lint-py | |
| lint: | |
| name: Lint Ansible code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Cache ansible requirements | |
| id: cache-reqs | |
| uses: actions/cache@v4 | |
| with: | |
| key: reqs-${{ runner.os }}-${{ hashFiles('requirements.yml') }} | |
| path: ${{ env.ANSIBLE_COLLECTIONS_PATH }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Install project | |
| run: uv sync --frozen | |
| - name: Install requirements | |
| if: steps.cache-reqs.outputs.cache-hit != 'true' | |
| run: uv run ansible-galaxy install -r requirements.yml | |
| - name: Lint code | |
| run: uv run ansible-lint | |
| changes: | |
| name: Detect changed scenarios | |
| permissions: | |
| pull-requests: read | |
| runs-on: ubuntu-latest | |
| outputs: | |
| discover: ${{ steps.filter-edited.outputs.changes }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for file changes | |
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
| id: filter | |
| with: | |
| filters: .github/file-filters.yml | |
| - name: Filter out `shared` group; If no changes detected, return `hello_world` scenario | |
| id: filter-edited | |
| run: | | |
| JSON=$(echo '${{ steps.filter.outputs.changes }}' | jq -c 'map(select(. != "shared"))') | |
| if [[ $JSON == '[]' ]]; then | |
| JSON='["plugins/tests/molecule/hello_world"]' | |
| fi | |
| echo "changes=$JSON" >> $GITHUB_OUTPUT | |
| test: | |
| name: Tests | |
| needs: [changes] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| molecule-distro: [debian13] | |
| molecule-discover: ${{ fromJSON(needs.changes.outputs.discover) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Cache ansible requirements | |
| id: cache-reqs | |
| uses: actions/cache@v4 | |
| with: | |
| key: reqs-${{ runner.os }}-${{ hashFiles('requirements.yml') }} | |
| path: ${{ env.ANSIBLE_COLLECTIONS_PATH }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Install project | |
| run: uv sync --frozen | |
| - name: Install requirements | |
| if: steps.cache-reqs.outputs.cache-hit != 'true' | |
| run: uv run ansible-galaxy install -r requirements.yml | |
| - name: Run tests | |
| run: make test DRIVER=docker DISCOVER=${{ matrix.molecule-discover }} | |
| env: | |
| MOLECULE_DISTRO: ${{ matrix.molecule-distro }} | |
| galaxy-deploy: | |
| name: Release to Ansible Galaxy | |
| if: github.ref_type == 'tag' | |
| needs: [lint-py, lint, test] | |
| environment: | |
| name: galaxy | |
| url: https://galaxy.ansible.com/ui/repo/published/deadnews/util | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set version in galaxy.yml | |
| run: | | |
| sed "s|^version:.*$|version: ${GITHUB_REF_NAME#v}|" -i galaxy.yml | |
| - name: Upload collection to Ansible Galaxy | |
| uses: ansible/ansible-publish-action@a56a0328c92c1d4feedf5bd7f7cf7ec7a4ae3f09 # v1.0.0 | |
| with: | |
| api_key: ${{ secrets.GALAXY_API_KEY }} | |
| github-deploy: | |
| name: Release to GitHub | |
| if: github.ref_type == 'tag' | |
| needs: [lint-py, lint, test] | |
| environment: github-releases | |
| permissions: | |
| contents: write | |
| env: | |
| CHANGELOG: https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md | |
| PRERELEASE: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Create GitHub Release | |
| run: | | |
| gh release create ${GITHUB_REF_NAME} \ | |
| --title ${GITHUB_REF_NAME} \ | |
| --notes="See [the CHANGELOG](${CHANGELOG}) for more details." \ | |
| --draft=${PRERELEASE} \ | |
| --prerelease=${PRERELEASE} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |