build(Needs bump): fix webhook not triggering

This commit is contained in:
PalmDevs
2025-04-09 20:46:35 +07:00
parent ca3ac64390
commit 8942d27453
4 changed files with 96 additions and 118 deletions

View File

@@ -50,22 +50,11 @@ jobs:
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Build and release - name: Build, release, publish
env: env:
RELEASE_WORKFLOW_STEP: release
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REGISTRY_USER: ${{ github.repository_owner }} DOCKER_REGISTRY_USER: ${{ github.repository_owner }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} DOCKER_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DEBUG: semantic-release:*
run: bunx multi-semantic-release --debug
# We call multi-semantic-release twice to publish in a different step
# An environment variable determines which plugins in the config to run
- name: Trigger Portainer webhooks
if: github.ref == 'refs/heads/main'
env:
RELEASE_WORKFLOW_STEP: publish
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WEBSOCKET_API_PORTAINER_WEBHOOK_URL: ${{ secrets.WEBSOCKET_API_PORTAINER_WEBHOOK_URL }} WEBSOCKET_API_PORTAINER_WEBHOOK_URL: ${{ secrets.WEBSOCKET_API_PORTAINER_WEBHOOK_URL }}
DISCORD_BOT_PORTAINER_WEBHOOK_URL: ${{ secrets.DISCORD_BOT_PORTAINER_WEBHOOK_URL }} DISCORD_BOT_PORTAINER_WEBHOOK_URL: ${{ secrets.DISCORD_BOT_PORTAINER_WEBHOOK_URL }}
run: bunx multi-semantic-release run: bunx multi-semantic-release

View File

@@ -1,17 +1,7 @@
import defineSubprojectReleaseConfig from '../../semantic-release-config.js' import defineSubprojectReleaseConfig from '../../semantic-release-config.js'
export default defineSubprojectReleaseConfig({ export default defineSubprojectReleaseConfig({
plugins: plugins: [
process.env.RELEASE_WORKFLOW_STEP === 'publish'
? [
[
'@semantic-release/exec',
{
publishCmd: 'bun run scripts/trigger-portainer-webhook.ts',
},
],
]
: [
[ [
'@codedependant/semantic-release-docker', '@codedependant/semantic-release-docker',
{ {
@@ -28,5 +18,11 @@ export default defineSubprojectReleaseConfig({
], ],
}, },
], ],
[
'@semantic-release/exec',
{
successCmd: 'bun run scripts/trigger-portainer-webhook.ts',
},
],
], ],
}) })

View File

@@ -1,17 +1,7 @@
import defineSubprojectReleaseConfig from '../../semantic-release-config.js' import defineSubprojectReleaseConfig from '../../semantic-release-config.js'
export default defineSubprojectReleaseConfig({ export default defineSubprojectReleaseConfig({
plugins: plugins: [
process.env.RELEASE_WORKFLOW_STEP === 'publish'
? [
[
'@semantic-release/exec',
{
publishCmd: 'bun run scripts/trigger-portainer-webhook.ts',
},
],
]
: [
[ [
'@codedependant/semantic-release-docker', '@codedependant/semantic-release-docker',
{ {
@@ -28,5 +18,11 @@ export default defineSubprojectReleaseConfig({
], ],
}, },
], ],
[
'@semantic-release/exec',
{
successCmd: 'bun run scripts/trigger-portainer-webhook.ts',
},
],
], ],
}) })

View File

@@ -11,9 +11,7 @@ const Options = {
prerelease: true, prerelease: true,
}, },
], ],
plugins: plugins: [
process.env['RELEASE_WORKFLOW_STEP'] !== 'publish'
? [
[ [
'@semantic-release/commit-analyzer', '@semantic-release/commit-analyzer',
{ {
@@ -58,8 +56,7 @@ const Options = {
clearWorkspace: true, clearWorkspace: true,
}, },
], ],
] ],
: [],
} }
/** /**
@@ -70,6 +67,6 @@ export default function defineSubprojectReleaseConfig(subprojectOptions) {
return { return {
...Options, ...Options,
...subprojectOptions, ...subprojectOptions,
plugins: [...(subprojectOptions.plugins || []), ...(Options.plugins || [])], plugins: [...(Options.plugins || []), ...(subprojectOptions.plugins || [])],
} }
} }