APPS-2552 Post-release dxApi 0.13.10 (#130) #206
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Snapshot Workflow | |
on: | |
push: | |
branches: | |
- develop | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
publish: | |
name: Publish Snapshot | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v2 | |
- name: Install Java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Install other dependencies | |
run: | | |
sudo apt update -y && sudo apt install -y jq | |
- name: Delete existing snapshot versions | |
id: versions | |
run: | | |
set -x | |
common_version=`grep -o -P "\d+\.\d+\.\d+-SNAPSHOT" ./common/src/main/resources/application.conf || true` | |
if [ -z "$common_version" ]; then | |
echo "dxCommon version does not end in '-SNAPSHOT'; only snapshot versions are allowed in the develop branch" | |
exit 1 | |
fi | |
common_query="{\"query\": \"query { repository(owner:\\\"dnanexus\\\", name:\\\"dxScala\\\") { packages(names:[\\\"com.dnanexus.dxcommon\\\"], first:1) { nodes { version(version:\\\"${common_version}\\\") { id } } } } }\" }" | |
common_version_json=`curl \ | |
-X POST \ | |
-H "Accept: application/vnd.github.package-deletes-preview+json" \ | |
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-d "$common_query" \ | |
https://api.github.com/graphql` | |
common_version_id=`echo $common_version_json | jq -r ".data.repository.packages.nodes[0].version.id"` | |
if [ "$common_version_id" != "null" ]; then | |
common_delete_query="{\"query\": \"mutation { deletePackageVersion(input:{packageVersionId:\\\"${common_version_id}\\\"}) { success }}\"}" | |
common_delete_json=`curl -X POST \ | |
-H "Accept: application/vnd.github.package-deletes-preview+json" \ | |
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-d "$common_delete_query" \ | |
https://api.github.com/graphql` | |
common_result=`echo $common_delete_json | jq ".data.deletePackageVersion.success"` | |
if [ "$common_result" != "true" ]; then | |
echo "could not delete dxCommon version ${common_version} with package ID ${common_version_id}" | |
echo "$common_delete_json" | |
exit 1 | |
fi | |
fi | |
api_version=`grep -o -P "\d+\.\d+\.\d+-SNAPSHOT" ./api/src/main/resources/application.conf || true` | |
if [ -z "$api_version" ]; then | |
echo "dxApi version does not end in '-SNAPSHOT'; only snapshot versions are allowed in the develop branch" | |
exit 1 | |
fi | |
api_query="{\"query\": \"query { repository(owner:\\\"dnanexus\\\", name:\\\"dxScala\\\") { packages(names:[\\\"com.dnanexus.dxapi\\\"], first:1) { nodes { version(version:\\\"${api_version}\\\") { id } } } } }\" }" | |
api_version_json=`curl \ | |
-X POST \ | |
-H "Accept: application/vnd.github.package-deletes-preview+json" \ | |
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-d "$api_query" \ | |
https://api.github.com/graphql` | |
api_version_id=`echo $api_version_json | jq -r ".data.repository.packages.nodes[0].version.id"` | |
if [ "$api_version_id" != "null" ]; then | |
api_delete_query="{\"query\": \"mutation { deletePackageVersion(input:{packageVersionId:\\\"${api_version_id}\\\"}) { success }}\"}" | |
api_delete_json=`curl -X POST \ | |
-H "Accept: application/vnd.github.package-deletes-preview+json" \ | |
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-d "$api_delete_query" \ | |
https://api.github.com/graphql` | |
api_result=`echo $api_delete_json | jq ".data.deletePackageVersion.success"` | |
if [ "$api_result" != "true" ]; then | |
echo "could not delete dxApi version ${api_version} with package ID ${api_version_id}" | |
echo "$api_delete_json" | |
exit 1 | |
fi | |
fi | |
protocols_version=`grep -o -P "\d+\.\d+\.\d+-SNAPSHOT" ./protocols/src/main/resources/application.conf || true` | |
if [ -z "$protocols_version" ]; then | |
echo "dxFileAccessProtocols version does not end in '-SNAPSHOT'; only snapshot versions are allowed in the develop branch" | |
exit 1 | |
fi | |
protocols_query="{\"query\": \"query { repository(owner:\\\"dnanexus\\\", name:\\\"dxScala\\\") { packages(names:[\\\"com.dnanexus.dxfileaccessprotocols\\\"], first:1) { nodes { version(version:\\\"${protocols_version}\\\") { id } } } } }\" }" | |
protocols_version_json=`curl \ | |
-X POST \ | |
-H "Accept: application/vnd.github.package-deletes-preview+json" \ | |
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-d "$protocols_query" \ | |
https://api.github.com/graphql` | |
protocols_version_id=`echo $protocols_version_json | jq -r ".data.repository.packages.nodes[0].version.id"` | |
if [ "$protocols_version_id" != "null" ]; then | |
protocols_delete_query="{\"query\": \"mutation { deletePackageVersion(input:{packageVersionId:\\\"${protocols_version_id}\\\"}) { success }}\"}" | |
protocols_delete_json=`curl -X POST \ | |
-H "Accept: application/vnd.github.package-deletes-preview+json" \ | |
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-d "$protocols_delete_query" \ | |
https://api.github.com/graphql` | |
protocols_result=`echo $protocols_delete_json | jq ".data.deletePackageVersion.success"` | |
if [ "$protocols_result" != "true" ]; then | |
echo "could not delete dxFileAccessProtocols version ${protocols_version} with package ID ${protocols_version_id}" | |
echo "$protocols_delete_json" | |
exit 1 | |
fi | |
fi | |
yaml_version=`grep -o -P "\d+\.\d+\.\d+-SNAPSHOT" ./yaml/src/main/resources/application.conf || true` | |
if [ -z "$yaml_version" ]; then | |
echo "dxYaml version does not end in '-SNAPSHOT'; only snapshot versions are allowed in the develop branch" | |
exit 1 | |
fi | |
yaml_query="{\"query\": \"query { repository(owner:\\\"dnanexus\\\", name:\\\"dxScala\\\") { packages(names:[\\\"com.dnanexus.dxyaml\\\"], first:1) { nodes { version(version:\\\"${yaml_version}\\\") { id } } } } }\" }" | |
yaml_version_json=`curl \ | |
-X POST \ | |
-H "Accept: application/vnd.github.package-deletes-preview+json" \ | |
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-d "$yaml_query" \ | |
https://api.github.com/graphql` | |
yaml_version_id=`echo $yaml_version_json | jq -r ".data.repository.packages.nodes[0].version.id"` | |
if [ "$yaml_version_id" != "null" ]; then | |
yaml_delete_query="{\"query\": \"mutation { deletePackageVersion(input:{packageVersionId:\\\"${yaml_version_id}\\\"}) { success }}\"}" | |
yaml_delete_json=`curl -X POST \ | |
-H "Accept: application/vnd.github.package-deletes-preview+json" \ | |
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-d "$yaml_delete_query" \ | |
https://api.github.com/graphql` | |
yaml_result=`echo $yaml_delete_json | jq ".data.deletePackageVersion.success"` | |
if [ "$yaml_result" != "true" ]; then | |
echo "could not delete dxYaml version ${yaml_version} with package ID ${yaml_version_id}" | |
echo "$yaml_delete_json" | |
exit 1 | |
fi | |
fi | |
- name: Publish Snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
sbt 'project common' publish | |
sbt 'project api' publish | |
sbt 'project protocols' publish | |
sbt 'project yaml' publish |