Prepare Release #90
This file contains hidden or 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: Prepare Release | |
| on: | |
| workflow_dispatch: | |
| branches: ["master"] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: tibdex/github-app-token@v2 | |
| id: generate-token | |
| with: | |
| app_id: ${{ secrets.APP_ID }} | |
| private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.10' | |
| - name: Set up Java 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 11 | |
| distribution: temurin | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| - name: Cache local Maven repository | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Check swagger-bom version matches root version | |
| run: | | |
| ROOT_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec) | |
| BOM_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec --file modules/swagger-bom/pom.xml) | |
| echo "Root version: ${ROOT_VERSION}" | |
| echo "BOM version: ${BOM_VERSION}" | |
| if [ "${ROOT_VERSION}" != "${BOM_VERSION}" ]; then | |
| echo "ERROR: swagger-bom version (${BOM_VERSION}) does not match root version (${ROOT_VERSION}). Update modules/swagger-bom/pom.xml." | |
| exit 1 | |
| fi | |
| - name: Run prepare release script | |
| id: prepare-release | |
| run: | | |
| export MY_POM_VERSION=`./mvnw -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec` | |
| if [[ $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]]; | |
| then | |
| . ./CI/prepare-release.sh | |
| echo "PREPARE_RELEASE_OK=yes" >> $GITHUB_ENV | |
| else | |
| echo "not preparing release for release version: " ${MY_POM_VERSION} | |
| echo "PREPARE_RELEASE_OK=no" >> $GITHUB_ENV | |
| fi | |
| echo "SC_VERSION=$SC_VERSION" >> $GITHUB_ENV | |
| echo "SC_NEXT_VERSION=$SC_NEXT_VERSION" >> $GITHUB_ENV | |
| - name: Create Prepare Release Pull Request | |
| uses: peter-evans/create-pull-request@v8 | |
| if: env.PREPARE_RELEASE_OK == 'yes' | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| commit-message: prepare release ${{ env.SC_VERSION }} | |
| title: 'prepare release ${{ env.SC_VERSION }}' | |
| branch: prepare-release-${{ env.SC_VERSION }} | |
| env: | |
| ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SC_VERSION: | |
| SC_NEXT_VERSION: |