Skip to content

Commit

Permalink
ci: fix auto-release process race condition (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
abalias authored Feb 6, 2023
1 parent 02d559e commit e40bcbe
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 21 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ name: Deployment
# Trigger deployment when a new tag is pushed
# to a service component
on:
push:
tags:
- prism-agent-*
- iris-service-*
- mercury-mediator-*
workflow_call:
inputs:
component-tag:
required: true
type: string
env:
required: false
type: string
default: "dev"
workflow_dispatch:
inputs:
component-tag:
Expand All @@ -26,11 +30,11 @@ jobs:
id: parse-params
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "COMPONENT_TAG=${{ github.event.inputs.component-tag }}" >> $GITHUB_OUTPUT
echo "ENV=${{ github.event.inputs.env }}" >> $GITHUB_OUTPUT
echo "COMPONENT_TAG=${{ github.event.inputs.component-tag }}" >> "${GITHUB_OUTPUT}"
echo "ENV=${{ github.event.inputs.env }}" >> "${GITHUB_OUTPUT}"
else
echo "COMPONENT_TAG=${{ github.ref_name}}" >> $GITHUB_OUTPUT
echo "ENV=dev" >> $GITHUB_OUTPUT
echo "COMPONENT_TAG=${{ inputs.component-tag }}" >> "${GITHUB_OUTPUT}"
echo "ENV=${{ inputs.env }}" >> "${GITHUB_OUTPUT}"
fi
- name: Trigger deployment
uses: peter-evans/repository-dispatch@v2
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/prism-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ name: Prism agent testing workflow
# this will help to push fixes earlier and stop previous workflows
concurrency:
group: ${{ github.head_ref }}${{ github.ref }}-prism-agent
cancel-in-progress: true

on:
push:
Expand All @@ -28,8 +27,15 @@ jobs:
component-dir: "prism-agent/service"
secrets: inherit
release:
if: github.event_name == 'push'
if: github.event_name == 'push' && !contains(github.event.head_commit.message, 'chore(release)')
uses: ./.github/workflows/release.yml
with:
release-component: "prism-agent/service"
secrets: inherit
deploy:
if: github.event_name == 'push' && contains(github.event.head_commit.message, 'chore(release)')
uses: ./.github/workflows/deployment.yml
with:
component-tag: "${{ github.ref_name }}"
env: "dev"
secrets: inherit
2 changes: 1 addition & 1 deletion castor/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion connect/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion iris/client/scala-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion iris/service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion mercury/mercury-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion mercury/mercury-mediator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion pollux/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion prism-agent/service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion prism-node/client/scala-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
"prepareCmd": "sbt \"release release-version ${nextRelease.version} next-version ${nextRelease.version}-SNAPSHOT with-defaults\""
}
],
[
Expand Down

0 comments on commit e40bcbe

Please sign in to comment.