Skip to content

Commit

Permalink
chore: redo how github actions are used (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roguelazer authored Jun 14, 2024
1 parent a147d48 commit 08d7ada
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 10 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/main.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
on:
pull_request:
push:
branches: [main, test-me-*]

workflow_call:
jobs:
main:
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
on:
pull_request:
branches: ['*']
jobs:
ci:
uses: ./.github/workflows/ci.yml
secrets: inherit
15 changes: 15 additions & 0 deletions .github/workflows/on-push-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
push:
tags:
- 'v*'
permissions:
contents: write
packages: write
jobs:
ci:
uses: ./.github/workflows/ci.yml
secrets: inherit
release:
uses: ./.github/workflows/release.yml
needs: [ci]
secrets: inherit
7 changes: 7 additions & 0 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
on:
push:
branches: ['main']
jobs:
ci:
uses: ./.github/workflows/ci.yml
secrets: inherit
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish Release
on:
workflow_call:
concurrency:
group: ${{ github.workflow }}
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create a Release
uses: softprops/action-gh-release@v2
with:
body: "Create release ${{ github.ref_name }}"
make_latest: true
- shell: bash
run: |
tag="${{ github.ref_name }}"
if [[ "$tag" =~ ^v[0-9]+\. ]]; then
branch_name="$(echo "$tag" | cut -d. -f 1)"
git checkout -b "$branch_name" ${{ github.sha }}
git push -f origin "$branch_name":"$branch_name"
fi
26 changes: 20 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-merge-conflict
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: '0.28.5'
hooks:
- id: check-dependabot
args: ["--verbose"]
- id: check-github-actions
args: ["--verbose"]
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: v1.7.1.15
hooks:
- id: actionlint
additional_dependencies: [ pyflakes>=3.0.1, shellcheck-py>=0.9.0.5 ]

0 comments on commit 08d7ada

Please sign in to comment.