-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7049f92
commit 5ef7a43
Showing
2 changed files
with
29 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
@@ -34,8 +36,6 @@ jobs: | |
# Once these changes are made, they are pushed to the main branch | ||
create-release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
new-version: ${{ steps.create-release.outputs.new-version }} | ||
needs: check-for-release-file | ||
if: needs.check-for-release-file.outputs.has-release == 'true' | ||
steps: | ||
|
@@ -48,9 +48,6 @@ jobs: | |
git fetch --tags | ||
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
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 | ||
- name: Generate a token | ||
id: generate-token | ||
|
@@ -66,21 +63,21 @@ jobs: | |
git config --global user.email "[email protected]" | ||
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="$(cat CHANGELOG.md | grep -m1 -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+')" | ||
# 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 +128,14 @@ jobs: | |
- name: Publish to Sonatype | ||
run: | | ||
ARTIFACT_NAME="${{ matrix.service }}_2.12" | ||
NEW_VERSION="${{needs.create-release.outputs.new-version}}" | ||
sbt "project ${{ matrix.service }}" version | ||
NEW_VERSION=$(sbt "project ${{ matrix.service }}" version) | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RELEASE_TYPE: minor | ||
|
||
Just testing. |