Skip to content

Commit

Permalink
Configuration: consider release branches (#2382)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelcarmena authored Apr 27, 2021
1 parent a68a41c commit bdbf6af
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 13 deletions.
25 changes: 21 additions & 4 deletions .github/scripts/set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,26 @@ set -ex

echo "$JAVA_HOME_8_X64/bin" >> $GITHUB_PATH
echo "JAVA_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV
LATEST_PUBLISHED_VERSION=$(curl -L https://repo1.maven.org/maven2/io/arrow-kt/arrow-core/maven-metadata.xml | ggrep -oP '<latest>\K[^<]*')
if [ "$LATEST_PUBLISHED_VERSION" == "" ]; then exit 1; fi
RELEASE_VERSION=$(grep LATEST_VERSION $BASEDIR/gradle.properties | cut -d= -f2)

if [ "$GITHUB_REF" == "refs/heads/main" ]; then
LATEST_PUBLISHED_VERSION=$(curl -L https://repo1.maven.org/maven2/io/arrow-kt/arrow-core/maven-metadata.xml | ggrep -oP '<latest>\K[^<]*')
if [ "$LATEST_PUBLISHED_VERSION" == "" ]; then exit 1; fi
RELEASE_VERSION=$(grep LATEST_VERSION $BASEDIR/gradle.properties | cut -d= -f2)
NEW_RELEASE_VERSION_EXISTS=$([ "$LATEST_PUBLISHED_VERSION" == "$RELEASE_VERSION" ] && echo '0' || echo '1')
else
echo "Into release branch ..."
BRANCH_VERSION=$(echo $GITHUB_REF | cut -d/ -f4)
RELEASE_VERSION=$(grep LATEST_VERSION $BASEDIR/gradle.properties | cut -d= -f2)
NEW_RELEASE_VERSION_EXISTS=$([ "$BRANCH_VERSION" == "$RELEASE_VERSION" ] && echo '1' || echo '0')
if [ $NEW_RELEASE_VERSION_EXISTS == '0' ]; then
perl -pe "s/^VERSION_NAME=.*/VERSION_NAME=$BRANCH_VERSION-SNAPSHOT/g" -i $BASEDIR/gradle.properties
fi
fi

if [ $NEW_RELEASE_VERSION_EXISTS == '1' ]; then
perl -pe "s/^VERSION_NAME=.*/VERSION_NAME=$RELEASE_VERSION/g" -i $BASEDIR/gradle.properties
fi

echo "LATEST_PUBLISHED_VERSION=$LATEST_PUBLISHED_VERSION" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "NEW_RELEASE_VERSION_EXISTS="$([ "$LATEST_PUBLISHED_VERSION" == "$RELEASE_VERSION" ] && echo '0' || echo '1') >> $GITHUB_ENV
echo "NEW_RELEASE_VERSION_EXISTS=$NEW_RELEASE_VERSION_EXISTS" >> $GITHUB_ENV
1 change: 1 addition & 0 deletions .github/scripts/show-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -e

grep VERSION_NAME $BASEDIR/gradle.properties
echo "LATEST_PUBLISHED_VERSION: $LATEST_PUBLISHED_VERSION"
echo "RELEASE_VERSION: $RELEASE_VERSION"
echo "NEW_RELEASE_VERSION_EXISTS: $NEW_RELEASE_VERSION_EXISTS"
6 changes: 2 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- release/**
paths:
- 'arrow-libs/**'
- '.github/**'
Expand Down Expand Up @@ -32,9 +33,6 @@ jobs:
run: ${GITHUB_WORKSPACE}/.github/scripts/set-env.sh
- name: "Show env"
run: ${GITHUB_WORKSPACE}/.github/scripts/show-env.sh
- name: "Update version when release"
if: env.NEW_RELEASE_VERSION_EXISTS == '1'
run: perl -pe "s/^VERSION_NAME=.*/VERSION_NAME=$RELEASE_VERSION/g" -i $BASEDIR/gradle.properties
- name: "Publish"
working-directory: arrow-libs
run: |
Expand All @@ -49,5 +47,5 @@ jobs:
git tag -a $RELEASE_VERSION -m "Release $RELEASE_VERSION"
git push origin $RELEASE_VERSION
- name: "Create release notes"
if: env.NEW_RELEASE_VERSION_EXISTS == '1'
if: ${{ env.NEW_RELEASE_VERSION_EXISTS == '1' && github.ref == 'refs/heads/main' }}
run: ${GITHUB_WORKSPACE}/.github/scripts/create-release-notes.sh
4 changes: 1 addition & 3 deletions .github/workflows/publish_arrow-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- release/**
paths:
- 'arrow-libs/**'
- 'arrow-stack/**'
Expand Down Expand Up @@ -34,9 +35,6 @@ jobs:
run: ${GITHUB_WORKSPACE}/.github/scripts/set-env.sh
- name: "Show env"
run: ${GITHUB_WORKSPACE}/.github/scripts/show-env.sh
- name: "Update version when release"
if: env.NEW_RELEASE_VERSION_EXISTS == '1'
run: perl -pe "s/^VERSION_NAME=.*/VERSION_NAME=$RELEASE_VERSION/g" -i $BASEDIR/gradle.properties
- name: "Publish"
run: |
./gradlew publish
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/publish_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- release/**
paths:
- 'arrow-libs/**'
- 'arrow-site/**'
Expand Down Expand Up @@ -48,17 +49,19 @@ jobs:
working-directory: arrow-site
run: ./gradlew runAnk
- name: "Landing page: build"
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: arrow-site
run: |
bundle exec jekyll build -b docs -s build/site
tree _site > $BASEDIR/logs/content_docs.log
- name: "Landing page: publish"
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: arrow-site
run: |
echo ">>> Landing page" >> $BASEDIR/logs/aws_sync.log
${GITHUB_WORKSPACE}/.github/scripts/publish-landing-page.sh
- name: "Latest release: publish (docs/)"
if: env.NEW_RELEASE_VERSION_EXISTS == '1'
if: ${{ env.NEW_RELEASE_VERSION_EXISTS == '1' && github.ref == 'refs/heads/main' }}
working-directory: arrow-site
run: |
echo ">>> Latest release" >> $BASEDIR/logs/aws_sync.log
Expand All @@ -85,17 +88,19 @@ jobs:
exit 1
fi
- name: "Next version: build (/docs/next)"
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: arrow-site
run: |
bundle exec jekyll build -b docs/next -s build/site
tree _site > $BASEDIR/logs/content_docs-next.log
- name: "Next version: publish (/docs/next)"
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: arrow-site
run: |
echo ">>> NEXT VERSION" >> $BASEDIR/logs/aws_sync.log
aws s3 sync _site s3://$S3_BUCKET/docs/next --delete >> $BASEDIR/logs/aws_sync.log
- name: "Site: publish sitemap.xml"
if: env.NEW_RELEASE_VERSION_EXISTS == '1'
if: ${{ env.NEW_RELEASE_VERSION_EXISTS == '1' && github.ref == 'refs/heads/main' }}
run: |
${GITHUB_WORKSPACE}/.github/scripts/create-sitemap.sh > sitemap.xml
aws s3 cp sitemap.xml s3://$S3_BUCKET/sitemap.xml >> $BASEDIR/logs/aws_sync.log
Expand Down
31 changes: 31 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,34 @@ Then, it will be necessary to close and release the Sonatype repository to sync
4. **Release** to sync with Maven Central (**Drop** and repeat if there are issues).

NOTE: [This plugin](https://github.com/gradle-nexus/publish-plugin) provides tasks for closing and releasing the staging repositories. However, that plugin must be applied to the root project and it would be necessary to discard modules for publication. Let's keep this note here to give it a try later on.

## Fixes from previous versions

When fixing `major.minor.patch` version:

1. Create `release/major.minor.(patch + 1)` branch from tag `major.minor.patch`.
2. Apply the fix into the new branch:
* Via pull request for new changes.
* Directly for existing changes (cherry-pick).
3. Check that new `major.minor.(patch + 1)-SNAPSHOT` artifacts are deployed into [Sonatype OSSRH](https://oss.sonatype.org/service/local/repositories/snapshots/content/io/arrow-kt/) with the fixes.
4. Try the new `major.minor.(patch + 1)-SNAPSHOT` version.
5. Create a pull request into `main` branch if the new changes must be applied to the new versions as well.
6. Create a pull request into `release/major.minor.(patch + 1)` branch:
* Change `LATEST_VERSION` in `arrow-libs/gradle.properties`.
* Update the version in `README.md`.
* Update the version in [the QuickStart section of the website](arrow-site/docs/docs/quickstart/README.md).
* Update [the sidebar](arrow-site/docs/_data/doc-versions.yml).

What will happen when merging the last pull request?

* New Arrow libraries will be published with `major.minor.(patch + 1)` version into Sonatype staging repository.
* `major.minor.(patch + 1)` tag will be created.
* `doc/major.minor` directory in the website will be updated.

TODO: Release notes and GitHub release must be created manually.

Then, it will be necessary to close and release the Sonatype repository to sync with Maven Central in the same way as other versions.

Last step:

* Update [the sidebar](arrow-site/docs/_data/doc-versions.yml) in the `main` branch to show the new latest version for `major.minor`.

0 comments on commit bdbf6af

Please sign in to comment.