Skip to content

Commit cc232d7

Browse files
committed
workflow now uses GITHUB_TOKEN
1 parent b3f1a59 commit cc232d7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Build and Publish Electron App
22

33
on:
4+
push:
5+
branches:
6+
- main
7+
- master
48
workflow_dispatch:
59

610
jobs:
@@ -71,8 +75,6 @@ jobs:
7175

7276
- name: Build for production with electron-builder
7377
run: npm run build:${{ matrix.target }}:${{ matrix.arch }}
74-
env:
75-
GH_TOKEN: ${{ secrets.GH_PAT }}
7678

7779
- name: "Debug: List release-builds directory"
7880
run: |
@@ -186,19 +188,25 @@ jobs:
186188
release:
187189
needs: build
188190
runs-on: ubuntu-latest
191+
permissions:
192+
contents: write
189193
steps:
190194
- name: Checkout code
191195
uses: actions/checkout@v3
196+
with:
197+
fetch-depth: 0
198+
token: ${{ secrets.GITHUB_TOKEN }}
192199

193200
- name: Get version and create tag
201+
env:
202+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
194203
run: |
195204
VERSION=$(node -p "require('./package.json').version")
196205
TAG_NAME="v${VERSION}"
197206
TIMESTAMP=$(date +'%Y%m%d%H%M%S')
198207
199208
git config --global user.name "github-actions[bot]"
200209
git config --global user.email "github-actions[bot]@users.noreply.github.com"
201-
git remote set-url origin https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}
202210
git fetch --tags
203211
204212
# Check if tag already exists, if so append timestamp
@@ -211,7 +219,7 @@ jobs:
211219
echo "Creating tag: $TAG_NAME"
212220
213221
git tag $TAG_NAME
214-
git push origin $TAG_NAME
222+
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git $TAG_NAME
215223
216224
- name: Download all artifacts
217225
uses: actions/download-artifact@v4
@@ -230,4 +238,4 @@ jobs:
230238
release-artifacts/**/*.snap
231239
release-artifacts/**/*.zip
232240
env:
233-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
241+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)