@kitschpatrol/repo-config 4.1.0 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- name: Create Release
1
+ name: Create GitHub Release
2
2
 
3
3
  on:
4
4
  push:
@@ -9,6 +9,10 @@ jobs:
9
9
  build:
10
10
  name: Create Release
11
11
  runs-on: ubuntu-latest
12
+ env:
13
+ ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
14
+ IS_VALID_COMMIT: false
15
+ TAG_NAME: ''
12
16
 
13
17
  steps:
14
18
  - name: Checkout
@@ -16,35 +20,48 @@ jobs:
16
20
  with:
17
21
  fetch-depth: 0
18
22
 
23
+ - name: Log Token Type
24
+ run: |
25
+ if [ ${{ env.ACCESS_TOKEN }} == ${{ secrets.GITHUB_TOKEN }} ]; then
26
+ echo "🗝️ Authenticated with GitHub Token"
27
+ else
28
+ echo "🔑 Authenticated with Personal Access token"
29
+ fi
30
+
19
31
  - name: Validate Tag and Branch
20
32
  id: validation
21
33
  run: |
22
34
  TAG=$(git tag --contains HEAD | grep '^v[0-9]' | head -n 1)
23
- BRANCH=$(git rev-parse --abbrev-ref HEAD)
24
35
  echo "🏷️ Tag for commit is: $TAG"
25
- echo "🕊️ Current branch is: $BRANCH"
26
- if [[ -z "$TAG" || "$BRANCH" != "main" ]]; then
27
- echo "is_valid_commit=false" >> $GITHUB_ENV
28
- echo "tag_name=''" >> $GITHUB_ENV
36
+ BRANCH=$(git branch -r --contains tags/${GITHUB_REF_NAME} | grep 'origin/main' | xargs)
37
+ if [[ -z "$BRANCH" ]]; then
38
+ echo "🚨 Tag is not on main branch"
39
+ else
40
+ echo "🕊️ Current branch is: $BRANCH"
41
+ fi
42
+ if [[ -z "$TAG" || -z "$BRANCH" ]]; then
43
+ echo "IS_VALID_COMMIT=false" >> $GITHUB_ENV
44
+ echo "TAG_NAME=''" >> $GITHUB_ENV
29
45
  else
30
- echo "is_valid_commit=true" >> $GITHUB_ENV
31
- echo "tag_name=$TAG" >> $GITHUB_ENV
46
+ echo "IS_VALID_COMMIT=true" >> $GITHUB_ENV
47
+ echo "TAG_NAME=$TAG" >> $GITHUB_ENV
32
48
  fi
33
49
 
34
50
  - name: Release Notes
35
- if: env.is_valid_commit == 'true'
51
+ if: env.IS_VALID_COMMIT == 'true'
36
52
  id: release-notes
37
53
  uses: Bullrich/generate-release-changelog@master
38
54
 
39
55
  - name: Release
40
- if: env.is_valid_commit == 'true'
56
+ if: env.IS_VALID_COMMIT == 'true'
41
57
  id: release
42
58
  uses: softprops/action-gh-release@v1
43
59
  with:
60
+ token: ${{ env.ACCESS_TOKEN }}
44
61
  draft: false
45
62
  prerelease: false
46
- name: ${{ env.tag_name }}
47
- tag_name: ${{ env.tag_name }}
63
+ name: ${{ env.TAG_NAME }}
64
+ tag_name: ${{ env.TAG_NAME }}
48
65
  body: |
49
66
  ${{ steps.release-notes.outputs.changelog }}
50
67
  files: |
@@ -57,8 +74,8 @@ jobs:
57
74
  changelog.md
58
75
 
59
76
  - name: Log Release Details
60
- if: env.is_valid_commit == 'true'
77
+ if: env.IS_VALID_COMMIT == 'true'
61
78
  run: |
62
- echo "📦 Successfully released: ${{ env.tag_name }}"
79
+ echo "📦 Successfully released: ${{ env.TAG_NAME }}"
63
80
  echo "🔗 Release URL: ${{ steps.release.outputs.url }}"
64
81
  echo "🪪 Release ID: ${{ steps.release.outputs.id }}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitschpatrol/repo-config",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "type": "module",
5
5
  "description": "Initial repo configuration for @kitschpatrol/shared-config",
6
6
  "repository": {
package/readme.md CHANGED
@@ -4,7 +4,12 @@
4
4
 
5
5
  It's a `pnpm`-flavored shared config with some essential files for a fresh repo.
6
6
 
7
- This includes [`.npmrc`](https://pnpm.io/npmrc) and `.gitignore` for now.
7
+ This includes the following:
8
+
9
+ - [`.npmrc`](https://pnpm.io/npmrc) with hoisting patterns for \`shared-config\`\` tool access
10
+ - `.gitignore` with typical patterns
11
+ - `.vscode` extension recommendations (additional settings and recommendations come from other `shared-config` packages)
12
+ - `.github` folder with a workflow for turning vX.X.X tags into GitHub releases
8
13
 
9
14
  It's needed to work around some hoisting issues related to plugin resolution in the other `@kitschpatrol/shared-config` packages.
10
15
 
@@ -37,3 +42,18 @@ Optionally, you can install the package if you think you'll ever want to regener
37
42
  ```sh
38
43
  pnpm exec repo-config --init
39
44
  ```
45
+
46
+ ### GitHub Configuration
47
+
48
+ There are two options for authenticating the release workflow action:
49
+
50
+ #### Github Token
51
+
52
+ 1. Ensure that read / write permissions are set for actions on the repository under Settings → Actions → General → Workflow permissions.
53
+
54
+ #### Personal Access token
55
+
56
+ If you want releases to come from your account instead of `github_actions`, then:
57
+
58
+ 1. Create a [fine-grained personal access token](https://github.com/settings/tokens?type=beta) in your GitHub account with the "Contents" repository permission set to "Read and Write".
59
+ 2. Add the token as a secret to the repository under the key `PERSONAL_ACCESS_TOKEN`.