Skip to content

Commit

Permalink
Merge pull request #6 from pollenjp/main-pre
Browse files Browse the repository at this point in the history
v0.1.4
  • Loading branch information
pollenjp authored Dec 1, 2023
2 parents a2f1af5 + 4226a8b commit 4bfd305
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 3 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/pull_request_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Release Drafter (autolabeler & check release tag)
on:
workflow_dispatch:
pull_request:
branches:
- main*
types:
- opened
- reopened
- synchronize
permissions:
contents: read
jobs:
call_autolabel_workflow:
permissions:
contents: read
pull-requests: write
uses: ./.github/workflows/pull_request_release.yml
check_release_version:
runs-on: ubuntu-latest
steps:
- name: Checkout
# https://github.com/actions/checkout
uses: actions/checkout@v4
- name: Extract package version
id: package_version
# https://github.com/freshautomations/stoml/releases
env:
STOML_VERSION: 0.7.1
run: |
set -eux -o pipefail
wget -O stoml "https://github.com/freshautomations/stoml/releases/download/v${STOML_VERSION}/stoml_linux_amd64"
chmod +x stoml
package_version=$(./stoml pyproject.toml project.version)
echo "package_version=${package_version}" >> $GITHUB_OUTPUT
- name: Check the tag is new and doesn't exist
run: |
set -eux -o pipefail
package_version="${{ steps.package_version.outputs.package_version }}"
if git fetch origin "refs/tags/v${package_version}"; then
echo "${package_version} tag already exists!" >&2
exit 1
fi
31 changes: 31 additions & 0 deletions .github/workflows/pull_request_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
#
# PRs for release/* branch
#
name: Release Drafter (autolabeler)
on:
workflow_dispatch:
pull_request:
branches:
- release/*
types:
- opened
- reopened
- synchronize
workflow_call:
permissions:
contents: read
jobs:
autolabel:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Create a PRs message
# https://github.com/release-drafter/release-drafter
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter-autolabel.yml
publish: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release Drafter
on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: read

jobs:
update_release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract package version
id: package_version
# https://github.com/freshautomations/stoml/releases
env:
STOML_VERSION: 0.7.1
run: |
set -eux -o pipefail
wget -O stoml "https://github.com/freshautomations/stoml/releases/download/v${STOML_VERSION}/stoml_linux_amd64"
chmod +x stoml
package_version=$(./stoml pyproject.toml project.version)
echo "PACKAGE_VERSION=${package_version}" >> $GITHUB_OUTPUT
- name: Push tag
run: |
set -eux -o pipefail
git tag v${{ steps.package_version.outputs.package_version }}
git push origin refs/tags/v${{ steps.package_version.outputs.package_version }}
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
version: ${{ steps.package_version.outputs.PACKAGE_VERSION }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/release_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Release Drafter (autolabeler & check release tag)
on:
workflow_dispatch:
push:
branches:
- main-pre
permissions:
contents: read
jobs:
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-pypi
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rye and build package
run: |
set -eux -o pipefail
curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash
source "${HOME}/.rye/env"
make build
- name: upload windows dists
uses: actions/upload-artifact@v3
with:
name: release-dists
path: dist/
test-pypi-publish: # https://github.com/pypa/gh-action-pypi-publish
name: Upload release to TestPyPI
runs-on: ubuntu-latest
needs:
- release-build
environment:
name: testpypi
url: https://test.pypi.org/p/ansible-lint-custom-strict-naming
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v3
with:
name: release-dists
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "ansible-lint-custom-strict-naming"
version = "0.1.3"
version = "0.1.4"
description = "Add your description here"
authors = [{ name = "pollenjp", email = "polleninjp@gmail.com" }]
dependencies = ["ansible-lint>=6.21.1"]
Expand Down
2 changes: 1 addition & 1 deletion src/rules/register_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
class RegisterPrefix(AnsibleLintRule):
id = ID
description = DESCRIPTION
tags = ["productivity"]
tags = ["formatting"]

def matchtask(self, task: Task, file: Lintable | None = None) -> bool | str:
if (task_result := task.get("register")) is None:
Expand Down
2 changes: 1 addition & 1 deletion src/rules/var_name_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
class VarNamePrefix(AnsibleLintRule):
id = ID
description = DESCRIPTION
tags = ["productivity"]
tags = ["formatting"]

def matchtask(self, task: Task, file: Lintable | None = None) -> UnmatchedType:
match task.action:
Expand Down

0 comments on commit 4bfd305

Please sign in to comment.