Update sync-docs.yml (#55) #13
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
--- | |
# yamllint disable rule:truthy | |
name: "Push on main/stable" | |
on: | |
push: | |
branches: | |
- stable | |
- main | |
paths-ignore: | |
- 'docs/**' | |
jobs: | |
check_commit: | |
runs-on: ubuntu-latest | |
outputs: | |
skip: ${{ steps.filter.outputs.skip }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 # Fetches the commit history for the last 2 commits | |
- id: filter | |
run: | | |
commit_author=$(git log -1 --pretty=format:'%an') | |
commit_message=$(git log -1 --pretty=format:'%s') | |
if [[ "$commit_author" == "opsmill-bot" && \ | |
"$commit_message" == "chore: update pyproject.toml & galaxy.yml" ]]; then | |
echo "skip=true" >> $GITHUB_OUTPUT | |
else | |
echo "skip=false" >> $GITHUB_OUTPUT | |
fi | |
prepare_release: | |
needs: check_commit | |
if: needs.check_commit.outputs.skip == 'false' | |
runs-on: ubuntu-22.04 | |
outputs: | |
next_version: ${{ steps.version.outputs.next-version }} | |
steps: | |
- name: "Set up Python" | |
uses: "actions/setup-python@v5" | |
with: | |
python-version: "3.11" | |
- name: "Install Poetry" | |
uses: "snok/install-poetry@v1" | |
with: | |
version: 1.8.5 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_INFRAHUB_BOT_TOKEN }} | |
fetch-depth: 0 | |
- name: Get Previous tag | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@master" | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Calculate next version | |
id: version | |
uses: patrickjahns/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update pyproject.toml versions | |
run: | | |
VERSION=${{ steps.version.outputs.next-version }} | |
echo "Updating to version $VERSION" | |
poetry version $VERSION # directly use the VERSION | |
- name: Update lock file | |
run: poetry lock --no-update | |
- name: commit pyproject.toml | |
uses: github-actions-x/[email protected] | |
with: | |
github-token: ${{ secrets.GH_INFRAHUB_BOT_TOKEN }} | |
push-branch: 'main' | |
commit-message: 'chore: update pyproject.toml' | |
files: pyproject.toml poetry.lock | |
name: opsmill-bot | |
email: [email protected] | |
rebase: true | |
release: | |
needs: ["prepare_release"] | |
uses: ./.github/workflows/workflow-release-drafter.yml | |
with: | |
version: ${{ needs.prepare_release.outputs.next_version }} | |
secrets: inherit |