Skip to content

Commit

Permalink
FIX: push to correct major/minor version branches (#20)
Browse files Browse the repository at this point in the history
* DX: add and implement Taplo formatting for TOML files

* DX: remove JSON sorting extension

* FIX: do not publish repository on PyPI

* MAINT: autoupdate pre-commit hooks

* MAINT: implement suggestions by updated hooks
  • Loading branch information
redeboer authored Apr 1, 2023
1 parent 19236b5 commit 8c4c0bd
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 20 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,27 @@ jobs:
milestone:
if: startsWith(github.ref, 'refs/tags')
uses: ComPWA/actions/.github/workflows/close-milestone.yml@v1
pypi:
if: startsWith(github.ref, 'refs/tags')
secrets: inherit
uses: ComPWA/actions/.github/workflows/publish-to-pypi.yml@v1
push:
push-to-version-branches:
name: Push to version branches
if: startsWith(github.ref, 'refs/tags') && !github.event.release.prerelease
secrets: inherit
uses: ComPWA/actions/.github/workflows/push-to-version-branches.yml@v1
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Configure Git credentials
run: |
git config --global user.name "GitHub Action"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Push to stable branch
run: |
git push origin HEAD:refs/heads/stable --force
- name: Push to matching minor version branch
env:
TAG: ${{ github.ref_name }}
run: |
re='^(v?)([0-9]+)\.([0-9]+)\.[0-9]+'
if [[ $TAG =~ $re ]]; then
MAJOR_VERSION="${BASH_REMATCH[2]}"
MINOR_VERSION="${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
git push origin HEAD:refs/heads/v$MAJOR_VERSION --force
git push origin HEAD:refs/heads/v$MINOR_VERSION --force
fi
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PYTHONHASHSEED: "0"

on:
push:
branches:
- main
- epic/*
pull_request:
branches:
- main
- epic/*
workflow_dispatch:
inputs:
specific-pip-packages:
description: Run CI with specific pip packages
required: false
type: string

jobs:
style:
if: inputs.specific-pip-packages == ''
secrets:
token: ${{ secrets.PAT }}
uses: ComPWA/actions/.github/workflows/pre-commit.yml@v1
3 changes: 1 addition & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ github:

vscode:
extensions:
- bungcip.better-toml
- christian-kohler.path-intellisense
- eamodio.gitlens
- editorconfig.editorconfig
Expand All @@ -26,7 +25,7 @@ vscode:
- redhat.vscode-yaml
- stkb.rewrap
- streetsidesoftware.code-spell-checker
- travisillig.vscode-json-stable-stringify
- tamasfe.even-better-toml
- trentrand.git-commit-helper-vscode
- tyriar.sort-lines
- yzhang.markdown-all-in-one
23 changes: 17 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ci:
autoupdate_commit_msg: "MAINT: autoupdate pre-commit hooks"
autoupdate_schedule: quarterly
skip:
- taplo

repos:
- repo: meta
Expand All @@ -21,30 +23,34 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/ComPWA/repo-maintenance
rev: 0.0.168
rev: 0.0.174
hooks:
- id: check-dev-files
args:
- --allow-deprecated-workflows
- --no-pypi
- --no-version-branches
- --repo-name=actions
- --repo-title=ComPWA actions and shared workflows
- id: format-setup-cfg

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v6.22.0
rev: v6.31.0
hooks:
- id: cspell

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.1
rev: "2.7.1"
hooks:
- id: editorconfig-checker
exclude: >
name: editorconfig
alias: ec
exclude: >-
(?x)^(
.*\.py
)$
Expand All @@ -55,7 +61,7 @@ repos:
- id: isort

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
rev: v3.0.0-alpha.6
hooks:
- id: prettier

Expand All @@ -65,3 +71,8 @@ repos:
- id: pyupgrade
args:
- --py37-plus

- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.0
hooks:
- id: taplo
16 changes: 16 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
exclude = [
"**/Cargo.toml",
"**/Manifest.toml",
"**/Project.toml",
"labels*.toml",
]

[formatting]
align_entries = false
array_auto_collapse = false
array_auto_expand = true
array_trailing_comma = true
column_width = 88
indent_string = " "
reorder_arrays = true
reorder_keys = true
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"recommendations": [
"bungcip.better-toml",
"christian-kohler.path-intellisense",
"eamodio.gitlens",
"editorconfig.editorconfig",
Expand All @@ -13,7 +12,7 @@
"redhat.vscode-yaml",
"stkb.rewrap",
"streetsidesoftware.code-spell-checker",
"travisillig.vscode-json-stable-stringify",
"tamasfe.even-better-toml",
"trentrand.git-commit-helper-vscode",
"tyriar.sort-lines",
"yzhang.markdown-all-in-one"
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"python.analysis.diagnosticMode": "workspace",
"python.analysis.typeCheckingMode": "basic",
"python.formatting.provider": "black",
"telemetry.telemetryLevel": "off",
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": [
".github/workflows/requirements.yml"
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
include = '\.pyi?$'
preview = true
target-version = [
"py310",
"py311",
"py37",
"py38",
"py39",
"py310",
"py311",
]

[tool.isort]
Expand Down

0 comments on commit 8c4c0bd

Please sign in to comment.