Cut release #35
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
# Adapted from: https://github.com/awslabs/aws-athena-query-federation/blob/master/.github/workflows/cut_release.yml | |
name: Cut release | |
on: | |
workflow_dispatch: | |
jobs: | |
cut_release: | |
name: Cut a release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update | |
run: | | |
sudo apt-get update | |
- name: Setup dependencies | |
run: | | |
sudo apt-get install -y libxml2-utils python3 | |
pip3 install lxml beautifulsoup4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'corretto' | |
java-version: '11' | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# See: https://stackoverflow.com/a/57969570 | |
- name: Setup previous release version environment variable | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: echo "PREVIOUS_RELEASE_VERSION=$(gh release list --exclude-drafts --exclude-pre-releases -L 1 | sed 's/.*\s\+Latest\s\+v\(.*\)\s\+.*/\1/g')" >> $GITHUB_ENV | |
- name: Setup previous release version tag environment variable | |
run: echo "PREVIOUS_RELEASE_TAG=v$PREVIOUS_RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Setup new release version environment variable | |
run: | | |
NEW_RELEASE_VERSION=$((echo $PREVIOUS_RELEASE_VERSION | grep "$(date +'%Y.%-U')" || date +'%Y.%-U.0') | python3 -c 'version = input().split("."); print(f"{version[0]}.{version[1]}.{int(version[2]) + 1}")') | |
echo "NEW_RELEASE_VERSION=$NEW_RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Create branch locally on the runner | |
run: git checkout -b release_${NEW_RELEASE_VERSION} origin/main | |
- name: Bump the versions in the branch | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
python3 tools/bump_versions/bump_all_version.py | |
# See: https://joht.github.io/johtizen/build/2022/01/20/github-actions-push-into-repository.html | |
- name: Setup workflow git committer user | |
run: | | |
git config --global user.name "athena_federation_cut_release_workflow" | |
git config --global user.email "[email protected]" | |
- name: Create the release bump commit | |
run: | | |
echo "Cut release $NEW_RELEASE_VERSION" > /tmp/RELEASE_MESSAGE | |
echo >> /tmp/RELEASE_MESSAGE | |
git fetch --tag origin | |
git log --format=' - %s' $PREVIOUS_RELEASE_TAG..HEAD >> /tmp/RELEASE_MESSAGE | |
git commit -a -F /tmp/RELEASE_MESSAGE | |
- name: Build jars | |
run: | | |
mvn clean package -T 1C -DskipTests | |
# Copy over the sdk-dsv2 jars | |
mkdir -p /tmp/sdk_dsv2_jars/ | |
cp ./athena-federation-sdk-dsv2/target/athena-federation-sdk-dsv2-${NEW_RELEASE_VERSION}.jar /tmp/sdk_dsv2_jars/ | |
# Copy over the connector jars | |
mkdir -p /tmp/connector_jars/ | |
find athena-*/target -name "*.jar" -type f | grep -v "/original" | grep -v "\-sdk-" | xargs -I{} cp {} /tmp/connector_jars/ | |
- name: Push the release branch | |
run: | | |
git push origin release_${NEW_RELEASE_VERSION}:release_${NEW_RELEASE_VERSION} | |
- name: Sync up with origin again now that the new branch has been pushed | |
run: | | |
git fetch origin | |
git pull --rebase origin release_${NEW_RELEASE_VERSION} | |
- name: Create the release on github | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
cat <<EOF > /tmp/RELEASE_NOTES | |
This version includes improvements and bugfixes in some connectors. See [here](https://github.com/awslabs/aws-athena-query-federation-dsv2/compare/v$PREVIOUS_RELEASE_VERSION..v$NEW_RELEASE_VERSION) for changes since the last release. | |
Binary distribution of the SDK DSV2 adapter and DSV2 adapted connectors can be found here. | |
You can assert the validity of the binary distribution by comparing against the below cksums. | |
Athena Federation SDK DSV2 jars | |
|CheckSum|File| | |
|----------|----| | |
$(cd /tmp/sdk_dsv2_jars && ls | xargs -I{} cksum {} | sed 's/\([0-9]\) \([a-zA-Z]\)/\1|\2/g' | sed 's/^/|/g' | sed 's/$/|/g') | |
Athena Federation Connector DSV2 jars | |
|CheckSum|File| | |
|----------|----| | |
$(cd /tmp/connector_jars && ls | xargs -I{} cksum {} | sed 's/\([0-9]\) \([a-zA-Z]\)/\1|\2/g' | sed 's/^/|/g' | sed 's/$/|/g') | |
## What's Changed | |
$(git log --format='- %s' v$PREVIOUS_RELEASE_VERSION..HEAD~1) | |
**Full Changelog**: https://github.com/awslabs/aws-athena-query-federation-dsv2/compare/v$PREVIOUS_RELEASE_VERSION..v$NEW_RELEASE_VERSION | |
EOF | |
# ------------------------------------------------------------------------------------------ | |
# Create the draft github release: | |
gh release create "v$NEW_RELEASE_VERSION" -d --latest \ | |
--target release_${NEW_RELEASE_VERSION} \ | |
-t "Release v$NEW_RELEASE_VERSION of Athena Query Federation DSV2" \ | |
--notes-file /tmp/RELEASE_NOTES | |
# Upload the jar attachments | |
gh release upload "v$NEW_RELEASE_VERSION" \ | |
$(find /tmp/sdk_dsv2_jars -type f) \ | |
$(find /tmp/connector_jars -type f) \ | |
--clobber |