Merge pull request #355 from shoriminimoe/release-1.6.1 #36
Workflow file for this run
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: Release and Publish | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup python 🐍 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies 👽 | |
| run: python -m pip install ansible-core yq rst-to-myst | |
| - name: Verify release 🗒️ | |
| env: | |
| TAG_NAME: ${{ github.ref_name }} | |
| run: | | |
| echo "::warning::TODO: confirm tests pass for this commit" | |
| tag_version="${TAG_NAME##*v}" | |
| version="$(yq -r .version galaxy.yml)" | |
| if [[ ${tag_version} != ${version} ]]; then | |
| echo "::error file=galaxy.yml::🔴 Tag version '${tag_version}' does not match galaxy.yml version '${version}'" | |
| exit 1 | |
| fi | |
| echo "::notice::🟢 Version number verified: '$version'" | |
| - name: Build 🛠️ | |
| run: ansible-galaxy collection build -v --force . | |
| - name: Prepare release notes 📓 | |
| env: | |
| CHANGELOG_URL: "${{ format('{0}/{1}/blob/{2}/CHANGELOG.rst', github.server_url, github.repository, github.ref_name) }}" | |
| REF_NAME: "${{ github.ref_name }}" | |
| run: | | |
| rst2myst stream --no-sphinx CHANGELOG.rst | csplit - "/^## ${REF_NAME}/" '/^## v.*/' | |
| mv xx01 release_notes.md | |
| echo "See also: [CHANGELOG](${CHANGELOG_URL}#${REF_NAME//./-})" >>release_notes.md | |
| - name: Release 🛸 | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| *.tar.gz | |
| body_path: release_notes.md | |
| fail_on_unmatched_files: true | |
| generate_release_notes: true | |
| publish: | |
| needs: release | |
| uses: ansible/ansible-content-actions/.github/workflows/release.yaml@main | |
| with: | |
| environment: release | |
| secrets: | |
| ah_token: ${{ secrets.AUTOMATION_HUB_API_KEY }} | |
| ansible_galaxy_api_key: ${{ secrets.GALAXY_API_KEY }} | |
| publish-docs: | |
| needs: release | |
| uses: ./.github/workflows/static.yml |