Skip to content

Commit a488106

Browse files
committed
fix: add GH_TOKEN to release workflow and include API build
1 parent cceca96 commit a488106

File tree

1 file changed

+44
-25
lines changed

1 file changed

+44
-25
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
4848
- name: Build Electron app
4949
run: npm run build
50-
# Note: Don't pass GH_TOKEN here - it causes electron-builder to auto-publish draft releases
51-
# The release job handles publishing after all builds complete
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5252

5353
- name: Upload Windows artifacts
5454
uses: actions/upload-artifact@v4
@@ -79,8 +79,8 @@ jobs:
7979

8080
- name: Build Electron app
8181
run: npm run build
82-
# Note: Don't pass GH_TOKEN here - it causes electron-builder to auto-publish draft releases
83-
# The release job handles publishing after all builds complete
82+
env:
83+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8484

8585
- name: Upload macOS artifacts
8686
uses: actions/upload-artifact@v4
@@ -91,26 +91,53 @@ jobs:
9191
release/latest-mac.yml
9292
if-no-files-found: warn
9393

94-
release:
95-
needs: [build-windows, build-macos]
94+
build-api:
9695
runs-on: ubuntu-latest
9796
permissions:
98-
contents: write
97+
contents: read
98+
packages: write
99+
env:
100+
REGISTRY: ghcr.io
101+
IMAGE_NAME: bluerobotics/blueplm-api
99102
steps:
100-
- name: Checkout
103+
- name: Checkout repository
101104
uses: actions/checkout@v4
102105

103-
- name: Download Windows artifacts
104-
uses: actions/download-artifact@v4
106+
- name: Log in to Container Registry
107+
uses: docker/login-action@v3
105108
with:
106-
name: windows-build
107-
path: dist/windows
109+
registry: ${{ env.REGISTRY }}
110+
username: ${{ github.actor }}
111+
password: ${{ secrets.GITHUB_TOKEN }}
108112

109-
- name: Download macOS artifacts
110-
uses: actions/download-artifact@v4
113+
- name: Extract metadata
114+
id: meta
115+
uses: docker/metadata-action@v5
111116
with:
112-
name: macos-build
113-
path: dist/macos
117+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
118+
tags: |
119+
type=raw,value=latest
120+
type=sha,prefix=
121+
type=ref,event=tag
122+
123+
- name: Build and push Docker image
124+
uses: docker/build-push-action@v5
125+
with:
126+
context: .
127+
file: ./api/Dockerfile
128+
push: true
129+
no-cache: true
130+
tags: ${{ steps.meta.outputs.tags }}
131+
labels: ${{ steps.meta.outputs.labels }}
132+
133+
update-release:
134+
needs: [build-windows, build-macos, build-api]
135+
runs-on: ubuntu-latest
136+
permissions:
137+
contents: write
138+
steps:
139+
- name: Checkout
140+
uses: actions/checkout@v4
114141

115142
- name: Get version from tag
116143
id: get_version
@@ -120,24 +147,16 @@ jobs:
120147
id: changelog
121148
run: |
122149
VERSION="${GITHUB_REF#refs/tags/v}"
123-
# Extract the section for this version from CHANGELOG.md
124-
# Finds content between ## [VERSION] and the next ## [ or end of file
125150
CHANGELOG=$(awk "/^## \[${VERSION}\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md)
126-
# Handle multi-line output for GitHub Actions
127151
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
128152
echo "$CHANGELOG" >> $GITHUB_OUTPUT
129153
echo "EOF" >> $GITHUB_OUTPUT
130154
131-
- name: Create Release
155+
- name: Update release with changelog
132156
uses: softprops/action-gh-release@v1
133157
with:
134158
name: ${{ steps.get_version.outputs.VERSION }}
135159
body: ${{ steps.changelog.outputs.CHANGELOG }}
136160
draft: false
137-
prerelease: false
138-
files: |
139-
dist/windows/*
140-
dist/macos/*
141161
env:
142162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143-

0 commit comments

Comments
 (0)