Skip to content

Commit

Permalink
DAT-15738



 DevOps: Refactor extensions upload xsds job to reusable…
Browse files Browse the repository at this point in the history
… workflows (#143)

* chore(create-release.yml): update version of sonar-push.yml to v0.6.0 for better compatibility
chore(extension-attach-artifact-release.yml): update version of scripts to v0.6.0 for better compatibility
chore(extension-release-prepare.yml): update version of extension-release-rollback.yml to v0.6.0 for better compatibility
chore(extension-release-published.yml): update version of extension-release-prepare.yml to v0.6.0 for better compatibility
chore(os-extension-test.yml): update version of sonar-pull-request.yml to v0.6.0 for better compatibility
chore(package-linux.yml): update version of scripts and package-deb-pom.xml to v0.6.0 for better compatibility
chore(pom-release-published.yml): update version of extension-release-prepare.yml to v0.6.0 for better compatibility
chore(pro-extension-test.yml): update version of sonar-pull-request.yml to v0.6.0 for better compatibility

* fix(extension-release-published.yml): update path and repository variables to use inputs.nameSpace instead of inputs.extraCommand for better clarity and consistency
feat(extension-release-published.yml): update file paths and links in index.htm to use inputs.nameSpace instead of inputs.extraCommand for better clarity and consistency

* fix(extension-release-published.yml): update path and repository values to use the name of the repository dynamically
feat(extension-release-published.yml): add support for syncing files and directories based on the name of the repository dynamically
  • Loading branch information
jandroav authored Jan 2, 2024
1 parent 9f4a8a8 commit 1fe6601
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
sonar:
uses: liquibase/build-logic/.github/workflows/sonar-push.yml@v0.5.9
uses: liquibase/build-logic/.github/workflows/sonar-push.yml@v0.6.0
secrets: inherit
with:
extraCommand: ${{ inputs.extraCommand }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/extension-attach-artifact-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ jobs:
- name: Get Reusable Script Files
run: |
curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.9/.github/get_draft_release.sh
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.9/.github/sign_artifact.sh
curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.9/.github/upload_asset.sh
curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.6.0/.github/get_draft_release.sh
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.6.0/.github/sign_artifact.sh
curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.6.0/.github/upload_asset.sh
chmod +x $PWD/.github/get_draft_release.sh
chmod +x $PWD/.github/sign_artifact.sh
chmod +x $PWD/.github/upload_asset.sh
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
- name: Get upload_zip.sh Script File
if: inputs.zip == 'true'
run: |
curl -o $PWD/.github/upload_zip.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.9/.github/upload_zip.sh
curl -o $PWD/.github/upload_zip.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.6.0/.github/upload_zip.sh
chmod +x $PWD/.github/upload_zip.sh
- name: Attach Zip File to Draft Release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/extension-release-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
release-rollback:
needs: prepare-release
if: ${{ always() && contains(needs.*.result, 'failure') }}
uses: liquibase/build-logic/.github/workflows/extension-release-rollback.yml@v0.5.9
uses: liquibase/build-logic/.github/workflows/extension-release-rollback.yml@v0.6.0
secrets: inherit
with:
extraCommand: ${{ inputs.extraCommand }}
49 changes: 48 additions & 1 deletion .github/workflows/extension-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
required: false
default: ''
type: string
nameSpace:
description: 'xsd namespace'
required: false
default: ''
type: string
secrets:
SONATYPE_USERNAME:
description: 'SONATYPE_USERNAME from the caller workflow'
Expand All @@ -18,7 +23,7 @@ on:

jobs:
maven-release:
uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.5.9
uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.6.0
secrets: inherit
with:
extraCommand: ${{ inputs.extraCommand }}
Expand Down Expand Up @@ -139,3 +144,45 @@ jobs:
-Dfiles=${{ env.artifact_id }}-${version}.jar.asc,${{ env.artifact_id }}-${version}-sources.jar.asc,${{ env.artifact_id }}-${version}-javadoc.jar.asc,${{ env.artifact_id }}-${version}.pom.asc \
-Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \
-Dclassifiers=,sources,javadoc,
deploy_xsd:
name: Upload xsds
runs-on: ubuntu-20.04
steps:
- name: Download xsd files
uses: actions/checkout@v4
with:
# Relative path under $GITHUB_WORKSPACE to place the repository
path: ${{ github.event.repository.name }}
repository: "liquibase/${{ github.event.repository.name }}"

- name: Upload to s3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.LIQUIBASEORIGIN_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.LIQUIBASEORIGIN_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
# aws s3 sync syncs directories and S3 prefixes.
run: |
aws s3 sync ${{ github.event.repository.name }}/src/main/resources/www.liquibase.org/xml/ns/${{ inputs.nameSpace }}/ s3://liquibaseorg-origin/xml/ns/${{ inputs.nameSpace }}/ --content-type application/octet-stream --only-show-errors
- name: Index.htm file upload
env:
AWS_ACCESS_KEY_ID: ${{ secrets.LIQUIBASEORIGIN_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.LIQUIBASEORIGIN_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
# List all xsd and htm files in repository. Copy index.htm to temporary folder
# Add links for all xsd files to index.htm file (except liquibase-${{ inputs.nameSpace }}-latest.xsd and index.htm)
# Sync index.htm with the s3
run: |
search_dir=${{ github.event.repository.name }}/src/main/resources/www.liquibase.org/xml/ns/${{ inputs.nameSpace }}
filenames=`ls -1 $search_dir`
mkdir index-file
cp $search_dir/index.htm index-file/
for entry in $filenames
do
if [[ "$entry" != "${{ github.event.repository.name }}-latest.xsd" ]] && [[ "$entry" != "index.htm" ]] ;then
sed -ie "s/<\/ul>/ <li><a href=\"\/xml\/ns\/${{ inputs.nameSpace }}\/${entry}\">${entry}<\/a><\/li>\n<\/ul>/" index-file/index.htm
fi
done
aws s3 sync index-file s3://liquibaseorg-origin/xml/ns/${{ inputs.nameSpace }}/ --only-show-errors
2 changes: 1 addition & 1 deletion .github/workflows/os-extension-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
sonar-pr:
if: ${{ !inputs.nightly }}
needs: [ unit-test ]
uses: liquibase/build-logic/.github/workflows/sonar-pull-request.yml@v0.5.9
uses: liquibase/build-logic/.github/workflows/sonar-pull-request.yml@v0.6.0
secrets: inherit
with:
extraCommand: ${{ inputs.extraCommand }}
10 changes: 5 additions & 5 deletions .github/workflows/package-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ jobs:
# Under the src folder is where specific packages files live. The GitHub action inputs will modify the universal package-deb-pom.xml to tell the process which assets to use during the packaging step
mkdir -p $PWD/.github/src/${{ inputs.artifactId }}/deb/control
mkdir -p $PWD/.github/src/${{ inputs.artifactId }}/main/archive
curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/control https://raw.githubusercontent.com/liquibase/build-logic/v0.5.9/src/${{ inputs.artifactId }}/deb/control/control
curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/postinst https://raw.githubusercontent.com/liquibase/build-logic/v0.5.9/src/${{ inputs.artifactId }}/deb/control/postinst
curl -o $PWD/.github/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.9/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh
curl -o $PWD/.github/package-deb-pom.xml https://raw.githubusercontent.com/liquibase/build-logic/v0.5.9/.github/package-deb-pom.xml
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.9/.github/sign_artifact.sh
curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/control https://raw.githubusercontent.com/liquibase/build-logic/v0.6.0/src/${{ inputs.artifactId }}/deb/control/control
curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/postinst https://raw.githubusercontent.com/liquibase/build-logic/v0.6.0/src/${{ inputs.artifactId }}/deb/control/postinst
curl -o $PWD/.github/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.6.0/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh
curl -o $PWD/.github/package-deb-pom.xml https://raw.githubusercontent.com/liquibase/build-logic/v0.6.0/.github/package-deb-pom.xml
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.6.0/.github/sign_artifact.sh
chmod +x $PWD/.github/sign_artifact.sh
- name: Import GPG key
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pom-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ jobs:
maven-release:
needs: release
uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.5.9
uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.6.0
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/pro-extension-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ jobs:
sonar-pr:
if: ${{ !inputs.nightly }}
needs: [ unit-test ]
uses: liquibase/build-logic/.github/workflows/sonar-pull-request.yml@v0.5.9
uses: liquibase/build-logic/.github/workflows/sonar-pull-request.yml@v0.6.0
secrets: inherit
with:
extraCommand: ${{ inputs.extraCommand }}

0 comments on commit 1fe6601

Please sign in to comment.