Skip to content

Commit

Permalink
feat: Publish sources only if not a snapshot (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohnoor94 authored Jun 20, 2023
1 parent ee83293 commit 300f0ed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/generator-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ on:
description: 'URL to download API specs from'
required: true
type: string
test:
snapshot:
description: 'Release a Snapshot? (Leave blank for no, anything else for yes)'
required: false
default: 'yes'
jobs:
prepare_version:
uses: ./.github/workflows/generator-prepare-version.yml
Expand Down Expand Up @@ -43,9 +44,10 @@ jobs:
with:
name: ${{ github.event.inputs.name }}
version: ${{ github.event.inputs.version }}
snapshot: ${{ github.event.inputs.snapshot }}
publish_artifact:
needs: [ publish_sources ]
uses: ./.github/workflows/generator-publish-artifact.yml
secrets: inherit
with:
test: ${{ github.event.inputs.test }}
snapshot: ${{ github.event.inputs.snapshot }}
4 changes: 2 additions & 2 deletions .github/workflows/generator-publish-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Generate SDK - Publish
on:
workflow_call:
inputs:
test:
snapshot:
description: 'Release snapshot?'
type: string
required: false
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
run: |
cd generator/sdk
if [ -z "${{ github.event.inputs.test }}" ]; then
if [ -z "${{ github.event.inputs.snapshot }}" ]; then
mvn deploy --settings $GITHUB_WORKSPACE/settings.xml -B -U -P release -DskipTests=true
else
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/generator-publish-sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
description: 'SDK Version'
required: true
type: string
snapshot:
description: 'Release snapshot?'
type: string
required: false

jobs:
publish:
Expand All @@ -27,6 +31,10 @@ jobs:
- name: Publish Code
working-directory: generator/sdk
run: |
if [ "${{github.event.inputs.snapshot}}" != "" ]; then
echo "Skipping publishing sources for a snapshot release"
exit 0
fi
git config --global user.email "[email protected]"
git config --global user.name "Expedia Group Open Source"
rm -rf ../../release/"${{github.event.inputs.name}}"
Expand Down

0 comments on commit 300f0ed

Please sign in to comment.