Skip to content

Commit 9816427

Browse files
Co-authored-by: salt-extensions-renovatebot[bot] <182623858+salt-extensions-renovatebot[bot]@users.noreply.github.com>
1 parent 89d7c6a commit 9816427

18 files changed

+390
-59
lines changed

.copier-answers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Autogenerated. Do not edit this by hand, use `copier update`.
22
---
3-
_commit: 0.5.0
3+
_commit: 0.6.0
44
_src_path: https://github.com/salt-extensions/salt-extension-copier
55
author: jeanluc
66
author_email: lkubb@protonmail.com
@@ -20,7 +20,7 @@ os_support:
2020
- Linux
2121
package_name: telegram
2222
project_name: telegram
23-
python_requires: '3.8'
23+
python_requires: '3.9'
2424
relax_pylint: true
2525
salt_version: '3006'
2626
source_url: https://github.com/salt-extensions/saltext-telegram

.github/workflows/ci.yml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,53 @@ jobs:
4747
- pre-commit
4848
uses: ./.github/workflows/docs-action.yml
4949

50+
check-prepare-release:
51+
name: Check if we can prepare release PR
52+
if: >-
53+
github.event_name == 'push' &&
54+
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
55+
needs:
56+
- docs
57+
- test
58+
runs-on: ubuntu-24.04
59+
outputs:
60+
news-fragments-available: ${{ steps.check-available.outputs.available }}
61+
62+
steps:
63+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
64+
65+
- name: Check if news fragments are available
66+
id: check-available
67+
run: |
68+
if [ -n "$(find changelog -type f -not -name '.*' -print -quit)" ]; then
69+
echo "available=1" >> "$GITHUB_OUTPUT"
70+
else
71+
echo "available=0" >> "$GITHUB_OUTPUT"
72+
fi
73+
74+
prepare-release:
75+
name: Prepare Release PR
76+
if: ${{ needs.check-prepare-release.outputs.news-fragments-available == '1' }}
77+
needs:
78+
- check-prepare-release
79+
- docs
80+
- test
81+
permissions:
82+
contents: write
83+
pull-requests: write
84+
uses: ./.github/workflows/prepare-release-action.yml
85+
5086
deploy-docs:
5187
name: Deploy Docs
5288
uses: ./.github/workflows/deploy-docs-action.yml
53-
# Only build doc deployments from the default branch of the repo and never for PRs.
89+
# Only build doc deployments from the default branch of the repo and never for PRs,
90+
# unless the triggering event was the release PR being merged.
5491
if: >-
55-
github.event_name != 'pull_request' &&
5692
inputs.deploy-docs &&
93+
(
94+
github.event_name != 'pull_request' ||
95+
inputs.release
96+
) &&
5797
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
5898
needs:
5999
- docs

.github/workflows/deploy-docs-action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
7272
- name: Upload Exit Status
7373
if: always()
74-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
74+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
7575
with:
7676
name: exitstatus-${{ github.job }}
7777
path: exitstatus

.github/workflows/deploy-package-action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
path: dist
3131

3232
- name: Publish distribution to Test PyPI
33-
uses: pypa/gh-action-pypi-publish@c44d2f0e52f028349e3ecafbf7f32561da677277 # v1.10.3
33+
uses: pypa/gh-action-pypi-publish@1bb664cc2ddedbbfdde43d4ac135d5836b7bf40f # v1.11.0
3434
if: ${{ inputs.test }}
3535
with:
3636
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
@@ -41,14 +41,14 @@ jobs:
4141
env:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4343
run: |
44-
gh release create "$GITHUB_REF_NAME" \
44+
gh release create "v${{ inputs.version }}" \
4545
--repo="$GITHUB_REPOSITORY" \
4646
--title="${GITHUB_REPOSITORY#*/} ${{ inputs.version }}" \
4747
--generate-notes \
4848
dist/*
4949
5050
- name: Publish distribution to PyPI
51-
uses: pypa/gh-action-pypi-publish@c44d2f0e52f028349e3ecafbf7f32561da677277 # v1.10.3
51+
uses: pypa/gh-action-pypi-publish@1bb664cc2ddedbbfdde43d4ac135d5836b7bf40f # v1.11.0
5252
if: ${{ !inputs.test }}
5353
with:
5454
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/docs-action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
timeout-minutes: 10
1111

1212
steps:
13-
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414
with:
1515
fetch-depth: 0
1616

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

@@ -35,7 +35,7 @@ jobs:
3535
nox --force-color -e docs
3636
3737
- name: Upload built docs as artifact
38-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
38+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
3939
with:
4040
name: html-docs
4141
path: docs/_build/html
@@ -48,7 +48,7 @@ jobs:
4848
4949
- name: Upload Exit Status
5050
if: always()
51-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
51+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
5252
with:
5353
name: exitstatus-${{ github.job }}
5454
path: exitstatus

.github/workflows/get-changed-files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
changed-files: ${{ toJSON(steps.changed-files.outputs) }}
1818

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

2222
- name: Get Changed Files
2323
id: changed-files

.github/workflows/package-action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414
runs-on: ubuntu-24.04
1515

1616
steps:
17-
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1818
with:
1919
fetch-depth: 0
2020

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

@@ -38,7 +38,7 @@ jobs:
3838
run: python -m build --outdir dist/
3939

4040
- name: Upload build artifacts
41-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
41+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
4242
if: always()
4343
with:
4444
name: salt-extension-${{ inputs.version }}-packages
@@ -53,7 +53,7 @@ jobs:
5353
5454
- name: Upload Exit Status
5555
if: always()
56-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
56+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
5757
with:
5858
name: exitstatus-${{ github.job }}
5959
path: exitstatus

.github/workflows/pr.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,47 @@ on:
1010
pull_request:
1111

1212
jobs:
13+
# After merging the release PR, we don't want to trigger
14+
# this workflow in addition to the Tagged Releases one.
15+
# This pauses CI on pushes to the main branch completely.
16+
check_release_in_progress:
17+
name: Skip CI While Releasing
18+
runs-on: ubuntu-24.04
19+
if: github.event_name == 'push'
20+
outputs:
21+
count: ${{ steps.workflow_count.outputs.count }}
22+
23+
steps:
24+
- name: Count Running Release Workflows Triggered by Automated PR
25+
id: workflow_count
26+
env:
27+
GH_TOKEN: ${{ github.token }}
28+
run: |
29+
count="$(gh run list \
30+
--repo "$GITHUB_REPOSITORY" \
31+
--event pull_request \
32+
--branch release/auto \
33+
--workflow 'Tagged Releases' \
34+
--json status \
35+
--jq 'map(select(.status == ("queued","in_progress"))) | length')"
36+
echo "count=$count" >> "$GITHUB_OUTPUT"
37+
1338
call_central_workflow:
1439
name: CI
40+
needs:
41+
- check_release_in_progress
42+
if: >
43+
always() &&
44+
github.event_name != 'push' ||
45+
(
46+
needs.check_release_in_progress.result == 'success' &&
47+
needs.check_release_in_progress.outputs.count == '0'
48+
)
1549
uses: ./.github/workflows/ci.yml
1650
with:
1751
deploy-docs: true
1852
permissions:
1953
contents: write
2054
id-token: write
2155
pages: write
22-
pull-requests: read
56+
pull-requests: write

.github/workflows/pre-commit-action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
name: Pre-Commit
1515
runs-on: ubuntu-24.04
1616
container:
17-
image: docker.io/library/python:3.10.15-slim-bookworm@sha256:1eb5d76bf3e9e612176ebf5eadf8f27ec300b7b4b9a99f5856f8232fd33aa16e
17+
image: docker.io/library/python:3.10.15-slim-bookworm@sha256:eb9ca77b1a0ffbde84c1dc333beb3490a2638813cc25a339f8575668855b9ff1
1818

1919
steps:
2020
- name: Install System Deps
@@ -23,7 +23,7 @@ jobs:
2323
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
2424
git config --global --add safe.directory "$(pwd)"
2525
26-
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727

2828
- name: Install Pre-Commit
2929
run: |
@@ -49,7 +49,7 @@ jobs:
4949
5050
- name: Upload Exit Status
5151
if: always()
52-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
52+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
5353
with:
5454
name: exitstatus-${{ github.job }}
5555
path: exitstatus
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: Prepare Release PR
3+
4+
on:
5+
workflow_call:
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: Override the autogenerated version.
10+
required: false
11+
default: ''
12+
type: string
13+
14+
jobs:
15+
update-release:
16+
name: Render changelog and create/update PR
17+
runs-on: ubuntu-24.04
18+
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
27+
- name: Set up Python 3.10
28+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
29+
with:
30+
python-version: '3.10'
31+
32+
- name: Install project
33+
run: |
34+
python -m pip install --upgrade pip
35+
python -m pip install '.[changelog]' pre-commit
36+
37+
- name: Get next version
38+
if: github.event_name == 'push' || inputs.version == ''
39+
id: next-version
40+
run: echo "version=$(python tools/version.py next)" >> "$GITHUB_OUTPUT"
41+
42+
- name: Update CHANGELOG.md
43+
env:
44+
NEXT_VERSION: ${{ (github.event_name == 'workflow_dispatch' && inputs.version != '') && inputs.version || steps.next-version.outputs.version }}
45+
run: towncrier build --yes --version "${NEXT_VERSION}"
46+
47+
- name: Run pre-commit once to remove trailing whitespace
48+
run: |
49+
python -m pre_commit run --files=CHANGELOG.md || true
50+
51+
- name: Create/update release PR
52+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
53+
with:
54+
commit-message: Release v${{ (github.event_name == 'workflow_dispatch' && inputs.version != '') && inputs.version || steps.next-version.outputs.version }}
55+
branch: release/auto
56+
sign-commits: true
57+
title: Release v${{ (github.event_name == 'workflow_dispatch' && inputs.version != '') && inputs.version || steps.next-version.outputs.version }}
58+
body: |
59+
This automated PR builds the latest changelog. When merged, a new release is published automatically.
60+
61+
Before merging, please ensure it's based on the most recent default branch HEAD.
62+
63+
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`.
64+
65+
You can still follow the manual release procedure outlined in: https://salt-extensions.github.io/salt-extension-copier/topics/publishing.html

0 commit comments

Comments
 (0)