From e27b0ef395204130fd46867f032a5807b4a8aafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Brychta?= Date: Tue, 1 Oct 2024 10:01:50 +0100 Subject: [PATCH] Testing #5780 --- .github/workflows/release.yml | 54 +++++++++++++++++------------------ RELEASE.md | 3 ++ 2 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 RELEASE.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d906b14..21c8eaf7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,11 @@ name: "Create release and publish packages to Sonatype" -on: - push: - branches: - - main +on: push + +#on: +# push: +# branches: +# - main permissions: id-token: write @@ -50,7 +52,7 @@ jobs: python3 .github/scripts/create_release.py ${LATEST_TAG} $(pwd) VERSION_TAG="$(cat CHANGELOG.md | grep -m1 -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+')" - echo "new-version=${VERSION_TAG:1}" >> $GITHUB_OUTPUT + echo "new-version=${VERSION_TAG:1}" >> $GITHUB_OUTPUT - name: Generate a token id: generate-token @@ -60,27 +62,27 @@ jobs: private-key: ${{ secrets.WELLCOME_COLLECTION_APP_PRIVATE_KEY }} - name: Configure git - # We need to give the GitHub action full repo privileges via a PAT so that it can push the release directly into main + # We need to give the GitHub action full repo privileges so that it can push the release directly into main run: | git config --global user.name "GitHub on behalf of Wellcome Collection" git config --global user.email "wellcomedigitalplatform@wellcome.ac.uk" git remote set-url origin https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/${{ github.repository }}.git - - - name: Commit and push changes - run: | - git checkout main - git pull - - git add CHANGELOG.md build.sbt - git rm RELEASE.md - - NEW_TAG="v${{steps.create-release.outputs.new-version}}" - git commit -m "$(printf "Release: Bump version to ${NEW_TAG}\n\n[skip ci]")" - git tag ${NEW_TAG} - - git push origin main - git push origin --tags +# +# - name: Commit and push changes +# run: | +# git checkout main +# git pull +# +# git add CHANGELOG.md build.sbt +# git rm RELEASE.md +# +# NEW_TAG="v${{ steps.create-release.outputs.new-version }}" +# git commit -m "$(printf "Release: Bump version to ${NEW_TAG}\n\n[skip ci]")" +# git tag ${NEW_TAG} +# +# git push origin main +# git push origin --tags # All sbt projects are published to Sonatype (https://central.sonatype.com/namespace/org.wellcomecollection). # Publishing involves several steps: @@ -131,15 +133,13 @@ jobs: - name: Publish to Sonatype run: | ARTIFACT_NAME="${{ matrix.service }}_2.12" - NEW_VERSION="${{needs.create-release.outputs.new-version}}" + NEW_VERSION="32.43.0" - SONATYPE_RESPONSE=$(curl "https://central.sonatype.com/solrsearch/select?q=g:org.wellcomecollection%20a:$ARTIFACT_NAME%20v:$NEW_VERSION") - ARTIFACT_COUNT=$(echo SONATYPE_RESPONSE | jq '.response | .numFound') + SONATYPE_RESPONSE=$(curl -s "https://central.sonatype.com/solrsearch/select?q=g:org.wellcomecollection%20a:$ARTIFACT_NAME%20v:$NEW_VERSION") + ARTIFACT_COUNT=$(echo $SONATYPE_RESPONSE | jq '.response | .numFound') - if [[ "ARTIFACT_COUNT" -eq 0 ]]; then + if [[ $ARTIFACT_COUNT -eq 0 ]]; then echo "Publishing package $ARTIFACT_NAME, version $NEW_VERSION to Sonatype." - PGP_PASSPHRASE=${{ secrets.GPG_PASSPHRASE }} sbt "project ${{ matrix.service }}" publishSigned - sbt "project ${{ matrix.service }}" sonatypeBundleRelease else echo "Package $ARTIFACT_NAME, version $NEW_VERSION already exists in Sonatype. Exiting." fi diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..f4244dbc --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,3 @@ +RELEASE_TYPE: minor + +Just testing.