Skip to content

Commit

Permalink
Merge pull request #251 from ernestojeda/fix-automated-release
Browse files Browse the repository at this point in the history
ci: only release when semantic-release generates a new version
  • Loading branch information
madhavilosetty-intel authored Oct 5, 2023
2 parents 90e3ee9 + 6317a8c commit 41bba9c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,26 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# the .nextVersion file will be created by semantic-release
- name: Get Next Version
id: version
run: |
git fetch --tags
echo "next=$(git tag | sort -r --version-sort | head -n1)" >> "$GITHUB_OUTPUT"
if [ -f .nextVersion ]; then
echo "next=$(cat .nextVersion)" >> "$GITHUB_OUTPUT"
else
echo "next=none" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
if: ${{ steps.version.outputs.next != 'none' }}
with:
repository: open-amt-cloud-toolkit/e2e-testing
ref: docker-release
clean: true
token: ${{ secrets.PROJECTS_PAT }}
token: ${{ secrets.DOCKER_RELEASE_PAT }}

- name: Create docker-release @ ${{ steps.version.outputs.next }}
if: ${{ steps.version.outputs.next != 'none' }}
env:
RELEASE_YAML: release/rpc-go.yml
NEXT_VERSION: ${{ steps.version.outputs.next }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ coverage
**/*.so
**/*.dll
**/*.h
**/launch.json
**/launch.json
.nextVersion
3 changes: 2 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"@semantic-release/exec",
{
"prepareCmd": "docker build -t vprodemo.azurecr.io/rpc-go:v${nextRelease.version} .",
"publishCmd": "docker push vprodemo.azurecr.io/rpc-go:v${nextRelease.version}"
"publishCmd": "docker push vprodemo.azurecr.io/rpc-go:v${nextRelease.version}",
"verifyReleaseCmd": "echo v${nextRelease.version} > .nextVersion"
}
]
]
Expand Down

0 comments on commit 41bba9c

Please sign in to comment.