[maven-release-plugin] prepare release v4.0.8 #4
Workflow file for this run
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
name: Release | |
on: | |
push: | |
tags: | |
- v* | |
env: | |
REGISTRY: ghcr.io | |
BASE_IMAGE_NAME: ghcr.io/oracle/weblogic-kubernetes-operator | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Set environmental variables" | |
run: | | |
VERSION=${GITHUB_REF_NAME#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "IMAGE_NAME=${{ env.BASE_IMAGE_NAME }}:$VERSION" >> $GITHUB_ENV | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Build | |
env: | |
GITHUB_TOKEN: ${{ secrets.PUBLISH_SECRET }} | |
run: mvn clean package -Dtag=${{ env.VERSION }} | |
- name: Create Draft Release | |
id: draft-release | |
run: | | |
echo 'PR_URL<<EOF' >> $GITHUB_ENV | |
gh release create ${{ github.ref_name }} \ | |
--draft \ | |
--generate-notes \ | |
--target release/4.0 \ | |
--title 'Operator ${{ env.VERSION }}' \ | |
--repo https://github.com/oracle/weblogic-kubernetes-operator | |
echo 'EOF' >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push container image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ env.IMAGE_NAME }} | |
- name: Checkout gh-pages | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
token: ${{ secrets.PUBLISH_SECRET }} | |
- name: Generate and publish Helm chart | |
run: | | |
curl -fL -o helm.tar.gz "https://get.helm.sh/helm-v3.12.1-linux-amd64.tar.gz" | |
tar -xf helm.tar.gz | |
export PATH="$PWD/linux-amd64:$PATH" | |
sed -i 's#4.0.0-RELEASE-MARKER#${{ env.BASE_IMAGE_NAME }}:${{ env.VERSION }}#g' $GITHUB_WORKSPACE/kubernetes/charts/weblogic-operator/values.yaml | |
mkdir $GITHUB_WORKSPACE/WORK | |
helm package --app-version $VERSION --version $VERSION $GITHUB_WORKSPACE/kubernetes/charts/weblogic-operator -d $GITHUB_WORKSPACE/WORK | |
cp $GITHUB_WORKSPACE/WORK/*.tgz $GITHUB_WORKSPACE/gh-pages/charts/ | |
helm repo index $GITHUB_WORKSPACE/gh-pages/charts/ --url https://oracle.github.io/weblogic-kubernetes-operator/charts | |
cd $GITHUB_WORKSPACE/gh-pages | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add --all | |
git commit -m "Helm chart update from release GitHub Action" | |
git push origin gh-pages |