Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…0.6.0 (#14)

Co-authored-by: salt-extensions-renovatebot[bot] <182623858+salt-extensions-renovatebot[bot]@users.noreply.github.com>
  • Loading branch information
salt-extensions-renovatebot[bot] authored Nov 3, 2024
1 parent d9b1539 commit b0a5351
Show file tree
Hide file tree
Showing 18 changed files with 430 additions and 102 deletions.
4 changes: 2 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Autogenerated. Do not edit this by hand, use `copier update`.
---
_commit: 0.5.0
_commit: 0.6.0
_src_path: https://github.com/lkubb/salt-extension-copier
author: EITR Technologies, LLC
author_email: devops@eitr.tech
Expand All @@ -24,7 +24,7 @@ os_support:
- Windows
package_name: consul
project_name: consul
python_requires: '3.8'
python_requires: '3.9'
relax_pylint: true
salt_version: '3006'
source_url: https://github.com/salt-extensions/saltext-consul
Expand Down
44 changes: 42 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,53 @@ jobs:
- pre-commit
uses: ./.github/workflows/docs-action.yml

check-prepare-release:
name: Check if we can prepare release PR
if: >-
github.event_name == 'push' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
needs:
- docs
- test
runs-on: ubuntu-24.04
outputs:
news-fragments-available: ${{ steps.check-available.outputs.available }}

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Check if news fragments are available
id: check-available
run: |
if [ -n "$(find changelog -type f -not -name '.*' -print -quit)" ]; then
echo "available=1" >> "$GITHUB_OUTPUT"
else
echo "available=0" >> "$GITHUB_OUTPUT"
fi
prepare-release:
name: Prepare Release PR
if: ${{ needs.check-prepare-release.outputs.news-fragments-available == '1' }}
needs:
- check-prepare-release
- docs
- test
permissions:
contents: write
pull-requests: write
uses: ./.github/workflows/prepare-release-action.yml

deploy-docs:
name: Deploy Docs
uses: ./.github/workflows/deploy-docs-action.yml
# Only build doc deployments from the default branch of the repo and never for PRs.
# Only build doc deployments from the default branch of the repo and never for PRs,
# unless the triggering event was the release PR being merged.
if: >-
github.event_name != 'pull_request' &&
inputs.deploy-docs &&
(
github.event_name != 'pull_request' ||
inputs.release
) &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
needs:
- docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: exitstatus-${{ github.job }}
path: exitstatus
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-package-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
path: dist

- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@c44d2f0e52f028349e3ecafbf7f32561da677277 # v1.10.3
uses: pypa/gh-action-pypi-publish@1bb664cc2ddedbbfdde43d4ac135d5836b7bf40f # v1.11.0
if: ${{ inputs.test }}
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
Expand All @@ -41,14 +41,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" \
gh release create "v${{ inputs.version }}" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${{ inputs.version }}" \
--generate-notes \
dist/*
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@c44d2f0e52f028349e3ecafbf7f32561da677277 # v1.10.3
uses: pypa/gh-action-pypi-publish@1bb664cc2ddedbbfdde43d4ac135d5836b7bf40f # v1.11.0
if: ${{ !inputs.test }}
with:
password: ${{ secrets.PYPI_API_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/docs-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
timeout-minutes: 10

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Set up Python 3.10 For Nox
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.10"

Expand All @@ -35,7 +35,7 @@ jobs:
nox --force-color -e docs
- name: Upload built docs as artifact
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: html-docs
path: docs/_build/html
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: exitstatus-${{ github.job }}
path: exitstatus
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/get-changed-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
changed-files: ${{ toJSON(steps.changed-files.outputs) }}

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Get Changed Files
id: changed-files
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/package-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Set up Python 3.10
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.10"

Expand All @@ -38,7 +38,7 @@ jobs:
run: python -m build --outdir dist/

- name: Upload build artifacts
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: always()
with:
name: salt-extension-${{ inputs.version }}-packages
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: exitstatus-${{ github.job }}
path: exitstatus
Expand Down
36 changes: 35 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,47 @@ on:
pull_request:

jobs:
# After merging the release PR, we don't want to trigger
# this workflow in addition to the Tagged Releases one.
# This pauses CI on pushes to the main branch completely.
check_release_in_progress:
name: Skip CI While Releasing
runs-on: ubuntu-24.04
if: github.event_name == 'push'
outputs:
count: ${{ steps.workflow_count.outputs.count }}

steps:
- name: Count Running Release Workflows Triggered by Automated PR
id: workflow_count
env:
GH_TOKEN: ${{ github.token }}
run: |
count="$(gh run list \
--repo "$GITHUB_REPOSITORY" \
--event pull_request \
--branch release/auto \
--workflow 'Tagged Releases' \
--json status \
--jq 'map(select(.status == ("queued","in_progress"))) | length')"
echo "count=$count" >> "$GITHUB_OUTPUT"
call_central_workflow:
name: CI
needs:
- check_release_in_progress
if: >
always() &&
github.event_name != 'push' ||
(
needs.check_release_in_progress.result == 'success' &&
needs.check_release_in_progress.outputs.count == '0'
)
uses: ./.github/workflows/ci.yml
with:
deploy-docs: true
permissions:
contents: write
id-token: write
pages: write
pull-requests: read
pull-requests: write
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Pre-Commit
runs-on: ubuntu-24.04
container:
image: docker.io/library/python:3.10.15-slim-bookworm@sha256:1eb5d76bf3e9e612176ebf5eadf8f27ec300b7b4b9a99f5856f8232fd33aa16e
image: docker.io/library/python:3.10.15-slim-bookworm@sha256:eb9ca77b1a0ffbde84c1dc333beb3490a2638813cc25a339f8575668855b9ff1

steps:
- name: Install System Deps
Expand All @@ -23,7 +23,7 @@ jobs:
apt-get install -y enchant-2 git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev
git config --global --add safe.directory "$(pwd)"
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install Pre-Commit
run: |
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: exitstatus-${{ github.job }}
path: exitstatus
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/prepare-release-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: Prepare Release PR

on:
workflow_call:
workflow_dispatch:
inputs:
version:
description: Override the autogenerated version.
required: false
default: ''
type: string

jobs:
update-release:
name: Render changelog and create/update PR
runs-on: ubuntu-24.04
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Python 3.10
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.10'

- name: Install project
run: |
python -m pip install --upgrade pip
python -m pip install '.[changelog]' pre-commit
- name: Get next version
if: github.event_name == 'push' || inputs.version == ''
id: next-version
run: echo "version=$(python tools/version.py next)" >> "$GITHUB_OUTPUT"

- name: Update CHANGELOG.md
env:
NEXT_VERSION: ${{ (github.event_name == 'workflow_dispatch' && inputs.version != '') && inputs.version || steps.next-version.outputs.version }}
run: towncrier build --yes --version "${NEXT_VERSION}"

- name: Run pre-commit once to remove trailing whitespace
run: |
python -m pre_commit run --files=CHANGELOG.md || true
- name: Create/update release PR
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
commit-message: Release v${{ (github.event_name == 'workflow_dispatch' && inputs.version != '') && inputs.version || steps.next-version.outputs.version }}
branch: release/auto
sign-commits: true
title: Release v${{ (github.event_name == 'workflow_dispatch' && inputs.version != '') && inputs.version || steps.next-version.outputs.version }}
body: |
This automated PR builds the latest changelog. When merged, a new release is published automatically.
Before merging, please ensure it's based on the most recent default branch HEAD.
If you want to rebuild this PR with a custom version or the current date, you can also trigger the corresponding workflow manually in `Actions` > `Prepare Release PR` > `Run workflow`.
You can still follow the manual release procedure outlined in: https://salt-extensions.github.io/salt-extension-copier/topics/publishing.html
Loading

0 comments on commit b0a5351

Please sign in to comment.