Skip to content

Commit 3557d7b

Browse files
authored
update template (#17)
1 parent c49356e commit 3557d7b

File tree

8 files changed

+98
-18
lines changed

8 files changed

+98
-18
lines changed

Taskfile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ tasks:
3131
snyk:
3232
cmds:
3333
- snyk test --file=requirements.txt
34+
- snyk test --file=package.json
3435
silent: true
3536
ghReleaseInit:
3637
cmds:

secret

Whitespace-only changes.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Bump Release Version
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
bump-release:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0 # Fetch all history for versioning
17+
18+
- name: Get Latest Tag
19+
id: get_latest_tag
20+
run: |
21+
LATEST_TAG=$(git tag --sort=-version:refname | head -n1)
22+
echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_ENV
23+
24+
- name: Get Current Version
25+
id: get_current_version
26+
run: |
27+
VERSION=${{ env.LATEST_TAG }}
28+
VERSION=${VERSION#v}
29+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
30+
31+
- name: Split Version into Components
32+
id: split_version
33+
run: |
34+
MAJOR=$(echo "${{ env.VERSION }}" | cut -d. -f1)
35+
MINOR=$(echo "${{ env.VERSION }}" | cut -d. -f2)
36+
PATCH=$(echo "${{ env.VERSION }}" | cut -d. -f3)
37+
echo "MAJOR=${MAJOR}" >> $GITHUB_ENV
38+
echo "MINOR=${MINOR}" >> $GITHUB_ENV
39+
echo "PATCH=${PATCH}" >> $GITHUB_ENV
40+
41+
- name: Calculate New Patch Version
42+
id: calculate_new_patch_version
43+
run: |
44+
NEW_PATCH=$(( ${{ env.PATCH }} + 1 ))
45+
echo "NEW_PATCH=${NEW_PATCH}" >> $GITHUB_ENV
46+
47+
- name: Set New Version
48+
id: set_new_version
49+
run: |
50+
NEW_VERSION="v${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.NEW_PATCH }}"
51+
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
52+
53+
- name: Display Version Info
54+
run: |
55+
echo "Latest tag is ${{ env.LATEST_TAG }}"
56+
echo "Current version is ${{ env.VERSION }}"
57+
echo "Bumping patch version to ${{ env.NEW_VERSION }}"
58+
59+
- name: Create New Git Tag
60+
run: |
61+
git tag "${{ env.NEW_VERSION }}"
62+
git push origin "${{ env.NEW_VERSION }}"
63+
env:
64+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- name: Create GitHub Release
67+
run: |
68+
gh release create "${{ env.NEW_VERSION }}" --generate-notes
69+
env:
70+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

template/.github/{% if ci_cd == 'github_actions' %}workflows{% endif %}/security.yaml renamed to template/.github/{% if ci_cd == 'github_actions' %}workflows{% endif %}/security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/checkout@v3
1010
# E.g., to check for my `~/Local/.secret` file
1111
- name: Custom check for secret files
12-
run: ./osConfig/shell/bin/check_for_pattern.sh . "*secret*"
12+
run: ./check_for_pattern.sh . "*secret*"
1313
- name: Install Whispers
1414
run: sudo pip install whispers
1515
# Use whispers to check repo for unecrypted secrets, passwords, etc.

template/.github/{% if ci_cd == 'github_actions' %}workflows{% endif %}/validate.yaml renamed to template/.github/{% if ci_cd == 'github_actions' %}workflows{% endif %}/validate.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ jobs:
99
- uses: actions/checkout@v3
1010
- uses: actions/setup-python@v4
1111
with:
12-
python-version: 3.x
13-
- uses: pre-commit/[email protected]
14-
- uses: pre-commit-ci/[email protected]
15-
if: always()
12+
python-version: 3.9
13+
- uses: pre-commit/[email protected]
14+
- uses: pre-commit-ci/[email protected]

template/.pre-commit-config.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-yaml
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
88
args: [--markdown-linebreak-ext=md]
99
- id: check-case-conflict
1010
- id: check-executables-have-shebangs
11-
exclude: '\.go$'
1211
- id: check-json
1312
- id: check-merge-conflict
1413
- id: check-shebang-scripts-are-executable
1514
exclude: "^(codeTemplates/|tempalte/|{% if code_templates %}codeTemplates{% endif %}/)"
16-
- id: check-symlinks
15+
# - id: check-symlinks # I needed to disable since I use symbolic links to files outside my repo which will cause the CI check to fail.
1716
- id: check-toml
1817
- id: check-xml
1918
- id: debug-statements
@@ -23,11 +22,11 @@ repos:
2322
- id: mixed-line-ending
2423
- id: no-commit-to-branch
2524
- repo: https://github.com/psf/black
26-
rev: 22.10.0
25+
rev: 24.10.0
2726
hooks:
2827
- id: black
2928
- repo: https://github.com/detailyang/pre-commit-shell
30-
rev: v1.0.6
29+
rev: 1.0.5
3130
hooks:
3231
- id: shell-lint
3332
args:
@@ -39,21 +38,26 @@ repos:
3938
--severity=error,
4039
]
4140
- repo: https://github.com/antonbabenko/pre-commit-terraform
42-
rev: v1.81.0
41+
rev: v1.96.1
4342
hooks:
4443
- id: terraform_fmt
4544
- id: terraform_docs
4645
- id: terraform_checkov
4746
- id: infracost_breakdown
4847
- repo: https://github.com/adrienverge/yamllint
49-
rev: v1.26.0
48+
rev: v1.35.1
5049
hooks:
5150
- id: yamllint
5251
language_version: python3.9
5352
- repo: https://github.com/ansible/ansible-lint
54-
rev: v6.17.2
53+
rev: v6.22.2
5554
hooks:
5655
- id: ansible-lint
56+
entry: python3 -m ansiblelint -v --force-color
57+
language: python
58+
# do not pass files to ansible-lint, see:
59+
# https://github.com/ansible/ansible-lint/issues/611
60+
pass_filenames: false
5761
ci:
5862
autofix_commit_msg: |
5963
[pre-commit.ci] auto fixes from pre-commit.com hooks

template/README.md.jinja

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
[{{ project_name }}]({{ project_url }})
55
Author: {{ author_full_name }}
66

7+
[![Validate](https://github.com/{{ author_git_provider_username }}/{{ project_slug }}/actions/workflows/validate.yml/badge.svg)](https://github.com/{{ author_git_provider_username }}/{{ project_slug }}/actions/workflows/validate.yml)
8+
[![Security](https://github.com/{{ author_git_provider_username }}/{{ project_slug }}/actions/workflows/security.yml/badge.svg)](https://github.com/{{ author_git_provider_username }}/{{ project_slug }}/actions/workflows/security.yml)
9+
710
## Setup & Installation
811

912
### Requirements

template/Taskfile.yml.jinja

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ tasks:
1414
validate:
1515
cmds:
1616
- pre-commit run --all-files
17-
- task: snyk
1817
# - shellcheck osConfig/mac/updateMac.sh
1918
# - shellcheck osConfig/mac/setupMac.sh
2019
# - shellcheck osConfig/mac/configureMacSettings.sh
2120
silent: true
21+
pre-commit:
22+
cmds:
23+
- pre-commit run --all-files
24+
silent: true
2225
security:
2326
cmds:
24-
- ./check_for_pattern.sh "secret"
27+
- ./check_for_pattern.sh . "*secret*"
2528
- whispers --config test/whisperConfig.yml --severity BLOCKER,CRITICAL .
2629
- task: snyk
2730
silent: true
@@ -82,7 +85,7 @@ tasks:
8285
- echo "Bumping minor version to {{.NEW_VERSION}}"
8386
- git tag {{.NEW_VERSION}}
8487
- git push origin {{.NEW_VERSION}}
85-
- gh release create
88+
- gh release create {{.NEW_VERSION}} --generate-notes
8689
vBumpMajor:
8790
desc: Bump to the next major version
8891
vars:
@@ -100,8 +103,8 @@ tasks:
100103
- echo "Current version is {{.VERSION}}"
101104
- echo "Bumping major version to {{.NEW_VERSION}}"
102105
- git tag {{.NEW_VERSION}}
103-
- git push origin {{.NEW_VERSION}}{% endraw %}
104-
- gh release create
106+
- git push origin {{.NEW_VERSION}}
107+
- gh release create{% endraw %}
105108
bunchAdd:
106109
cmds:
107110
- mv '.meta/Code Project - {{ project_name }}.bunch' '{{ bunches_directory }}/'

0 commit comments

Comments
 (0)