Skip to content

Commit

Permalink
Revert "Revamped release workflow (#1349)"
Browse files Browse the repository at this point in the history
This reverts commit 88eb204
  • Loading branch information
jponge committed Aug 31, 2023
1 parent c87937f commit d7d58f0
Show file tree
Hide file tree
Showing 10 changed files with 348 additions and 189 deletions.
79 changes: 79 additions & 0 deletions .build/cut-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env bash
set -e

init_gpg() {
gpg2 --fast-import --no-tty --batch --yes smallrye-sign.asc
}

init_git() {
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "smallrye@googlegroups.com"
}

# -------- SCRIPT START HERE -----------------

init_git
init_gpg

export VERSION=""
export BRANCH="HEAD"
export EXTRA_PRE_ARGS=""

if [[ ${DRY_RUN} == "true" ]]; then
echo "[DRY RUN] - Dry Run Enabled - Git push will be skipped."
fi

if [[ ${MICRO_RELEASE} == "true" ]]; then
EXTRA_PRE_ARGS="--micro"
fi

if [[ ! -z "${RELEASE_VERSION}" ]]; then
EXTRA_PRE_ARGS="${EXTRA_PRE_ARGS} --release-version=${RELEASE_VERSION}"
fi

jbang .build/PreRelease.java --token="${GITHUB_TOKEN}" ${EXTRA_PRE_ARGS}

export VERSION=""
if [ -f /tmp/release-version ]; then
VERSION=$(cat /tmp/release-version)
else
echo "'/tmp/release-version' expected after pre-release"
exit 1
fi

echo "Update website version to ${VERSION}"
.build/UpdateDocsAttributesFiles.java --mutiny-version=${VERSION}
if [[ $(git diff --stat) != '' ]]; then
git add documentation/attributes.yaml
git commit -m "Bumping the website version to ${VERSION}"
git push
echo "Version updated"
else
echo "The version was already correct"
fi

echo "Cutting release ${VERSION}"
./mvnw -s .build/maven-ci-settings.xml -B -fn clean
git checkout ${BRANCH}
HASH=$(git rev-parse --verify $BRANCH)
echo "Last commit is ${HASH} - creating detached branch"
git checkout -b "r${VERSION}" "${HASH}"

echo "Update version to ${VERSION}"
./mvnw -B versions:set -DnewVersion="${VERSION}" -DgenerateBackupPoms=false -s maven-settings.xml
./mvnw -B versions:set -DnewVersion="${VERSION}" -DgenerateBackupPoms=false -s maven-settings.xml -pl bom

if [[ ${SKIP_TESTS} == "true" ]]; then
./mvnw -B clean verify -Prelease -DskipTests -s maven-settings.xml
else
./mvnw -B clean verify -Prelease -s maven-settings.xml
fi

git commit -am "[RELEASE] - Bump version to ${VERSION}"
git tag "${VERSION}"
echo "Pushing tag to origin"
if [[ ${DRY_RUN} == "true" ]]; then
echo "[DRY RUN] - Skipping push: git push origin ${VERSION}"
else
git push origin "${VERSION}"
fi
22 changes: 22 additions & 0 deletions .build/deploy-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -e

init_gpg() {
gpg2 --fast-import --no-tty --batch --yes smallrye-sign.asc
}

init_git() {
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "smallrye@googlegroups.com"
}

# -------- SCRIPT START HERE -----------------

init_git
init_gpg

git fetch origin --tags
git reset --hard
git checkout "${REF}"
./mvnw -B clean deploy -DskipTests -Prelease -s maven-settings.xml

34 changes: 0 additions & 34 deletions .github/release.yml

This file was deleted.

20 changes: 10 additions & 10 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
java: [
Expand All @@ -21,9 +21,9 @@ jobs:
]
name: Build with Java ${{ matrix.java.version }} (OpenJDK)
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
name: Setup Java ${{matrix.java.version}}
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
name: set up jdk ${{matrix.java.version}}
with:
distribution: temurin
java-version: ${{matrix.java.version}}
Expand All @@ -36,10 +36,10 @@ jobs:
snapshot:
name: Deploy snapshots
needs: build
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: 11
distribution: temurin
Expand All @@ -55,10 +55,10 @@ jobs:
quality-and-compatibility:
name: Test coverage and compatibility checks
needs: build
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: 11
distribution: temurin
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
java: [
Expand All @@ -21,8 +21,8 @@ jobs:
]
name: Build with Java ${{ matrix.java.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
name: set up jdk ${{matrix.java.version}}
with:
distribution: temurin
Expand All @@ -35,11 +35,11 @@ jobs:
- name: Codecov
uses: codecov/codecov-action@v1.0.13
compatibility:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
name: Compatibility Check
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: 11
distribution: temurin
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Deploy releases to Maven Central
on:
push:
branches:
- "!*"
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

jobs:
perform-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.ref }}
token: ${{ secrets.RELEASE_TOKEN }}
- name: Install JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: temurin
cache: maven
- name: 'Deploy'
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
REF: ${{ github.event.ref }}
SECRET_FILES_PASSPHRASE: ${{ secrets.SECRET_FILES_PASSPHRASE }}
run: |
echo "Cutting release from ${REF}"
sudo apt-get update -o Dir::Etc::sourcelist="sources.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
sudo apt-get install -y gnupg2 gnupg-agent
sh .build/decrypt-secrets.sh
sh .build/deploy-release.sh
79 changes: 79 additions & 0 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
name: Post release work
on:
push:
branches:
- "!*"
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

jobs:
post-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.ref }}
token: ${{ secrets.RELEASE_TOKEN }}
- name: Install JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: temurin
cache: maven
- name: 'Run a quick local build'
run: ./mvnw -s .build/maven-ci-settings.xml clean install -DskipTests
- name: 'Collect Compatibility Justification'
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
SECRET_FILES_PASSPHRASE: ${{ secrets.SECRET_FILES_PASSPHRASE }}
run: |
sudo apt-get update -o Dir::Etc::sourcelist="sources.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
sudo apt-get install -y gnupg2 gnupg-agent
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh && sdk install jbang
mkdir -p target
jbang .build/CompatibilityUtils.java extract
- name: 'Post-Release Tasks'
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
REF: ${{ github.event.ref }}
run: |
TAG=$(echo ${REF} | sed -e 's%refs/tags/%%g')
source ~/.sdkman/bin/sdkman-init.sh && \
jbang .build/PostRelease.java --release-version=${TAG} --token=${GITHUB_TOKEN}
- name: 'Clear compatibility justifications'
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
REF: ${{ github.event.ref }}
run: |
source ~/.sdkman/bin/sdkman-init.sh
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "smallrye@googlegroups.com"
TAG=$(echo ${REF} | sed -e 's%refs/tags/%%g')
echo "Waiting for artifacts to be available from Maven Central, otherwise the build will fail during the compatibility verification"
echo "Version ${TAG}"
ARTIFACTS=$(./mvnw -s .build/maven-ci-settings.xml -Dexec.executable='echo' -Dexec.args='${project.groupId}:${project.artifactId}' exec:exec -q | tr '\n' ',')
echo "Artifacts: ${ARTIFACTS}"
jbang .build/WaitForCentral.java \
--artifacts=$ARTIFACTS \
--expected-version="${TAG}"
git clone -b main "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/smallrye/smallrye-mutiny.git" new-main
cd new-main
echo "Clearing difference justifications"
jbang .build/CompatibilityUtils.java clear --version="${TAG}" --do-not-clear-version-prefix="1."
if [[ $(git diff --stat) != '' ]]; then
git add -A
git status
git commit -m "[POST-RELEASE] - Clearing breaking change justifications"
git push origin main
else
echo "No justifications cleared"
fi
Loading

0 comments on commit d7d58f0

Please sign in to comment.