Skip to content

Commit

Permalink
Merge pull request #295 from eclipse-tractusx/bugfix/fix-swagger-work…
Browse files Browse the repository at this point in the history
…flow

chore(swagger-bugfix): refactor workflow to resolve release version tag issue
  • Loading branch information
saudkhan116 authored Apr 24, 2024
2 parents 3980aa7 + febe535 commit 661afc2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
29 changes: 7 additions & 22 deletions .github/workflows/publish-swagger-hub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ name: "Publish OpenAPI to Swaggerhub"

on:
push:
branches: [ "main", "develop" ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_call:
Expand Down Expand Up @@ -61,19 +60,16 @@ jobs:
run: |
npm i -g swaggerhub-cli
- name: Get version tag
- name: Extract version tag
id: version
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Set version tag
run: |
echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
if [ -z ${{ inputs.version }} ]; then
export DOWNSTREAM_VERSION=${{ steps.version.outputs.tag }}
export DOWNSTREAM_VERSION=${GITHUB_REF#refs/*/}
else
export DOWNSTREAM_VERSION=${{ inputs.version }}
fi
echo "[INFO] - DOWNSTREAM_VERSION=$DOWNSTREAM_VERSION" >> "$GITHUB_ENV"
echo "DOWNSTREAM_VERSION=$DOWNSTREAM_VERSION" >> "$GITHUB_ENV"
- name: Create and Download API specs
shell: bash
Expand All @@ -93,19 +89,8 @@ jobs:
docker rm test-container
# create API, will fail if exists
- name: Create API
- name: Create and publish API Specs to SwaggerHub
continue-on-error: true
run: |
swaggerhub api:create ${{ env.SWAGGERHUB_USER }}/digital-product-pass/${{ env.DOWNSTREAM_VERSION }} -f ./dpp-backend/digitalproductpass/tractusx-dpp-api.yaml --visibility=public --published=unpublish
# Post the API to SwaggerHub as "unpublished", because published APIs cannot be overwritten
- name: Publish API Specs to SwaggerHub
run: |
if [[ ${{ env.DOWNSTREAM_VERSION }} != *-SNAPSHOT ]]; then
echo "[INFO] - no snapshot, will set the API to 'published'";
swaggerhub api:update ${{ env.SWAGGERHUB_USER }}/digital-product-pass/${{ env.DOWNSTREAM_VERSION }} -f ./dpp-backend/digitalproductpass/tractusx-dpp-api.yaml --visibility=public --published=publish
swaggerhub api:setdefault ${{ env.SWAGGERHUB_USER }}/digital-product-pass/${{ env.DOWNSTREAM_VERSION }}
else
echo "[INFO] - snapshot, will set the API to 'unpublished'";
swaggerhub api:update ${{ env.SWAGGERHUB_USER }}/digital-product-pass/${{ env.DOWNSTREAM_VERSION }} -f ./dpp-backend/digitalproductpass/tractusx-dpp-api.yaml --visibility=public --published=unpublish
fi
swaggerhub api:create ${{ env.SWAGGERHUB_USER }}/digital-product-pass/${{ env.DOWNSTREAM_VERSION }} -f ./dpp-backend/digitalproductpass/tractusx-dpp-api.yaml --visibility=public --published=publish
swaggerhub api:setdefault ${{ env.SWAGGERHUB_USER }}/digital-product-pass/${{ env.DOWNSTREAM_VERSION }}
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [Unreleased]

### Added
Expand All @@ -43,12 +42,32 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e
- Updated documentation references where required
- Updated infrastructure guide
- Updated testdata script to allow EDC constrained policy for the registry
- Refactored the swagger workflow

### Deleted
- Deleted unused files/directories/docs/images
- Removed environment-specific values files from helm charts
- Removed MOCKed json payloads
- Removed docker directory
- Deleted veracode-pipeline workflow (replaced by CodeQL and dependabot)

### Issues Fixed
- Fixed tagging issue in swagger workflow
- Fixed table formatting in main `README.md`

### Dependencies Fixed by Dependabot
* chore(deps): bump actions/upload-artifact from 3 to 4 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/214
* chore(deps): bump helm/chart-testing-action from 2.3.1 to 2.6.1 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/216
* chore(deps): bump actions/setup-python from 4 to 5 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/220
* chore(deps): bump veracode/veracode-uploadandscan-action from 0.2.1 to 0.2.6 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/218
* chore(deps): bump actions/checkout from 3 to 4 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/284
* chore(deps): bump docker/build-push-action from 3 to 5 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/283
* chore(deps): bump container-tools/kind-action from 1 to 2 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/285
* chore(deps): bump github/codeql-action from 2 to 3 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/281
* chore(deps): bump follow-redirects from 1.15.4 to 1.15.6 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/258
* chore(deps): bump azure/setup-helm from 3 to 4 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/292
* chore(deps): bump helm/chart-releaser-action from 1.4.1 to 1.6.0 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/291
* chore(deps): bump actions/setup-java from 3 to 4 by @dependabot in https://github.com/eclipse-tractusx/digital-product-pass/pull/290


## [released]
Expand Down

0 comments on commit 661afc2

Please sign in to comment.