Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dwi_ght #452

Open
Dwi-ght opened this issue Mar 10, 2025 · 0 comments
Open

Dwi_ght #452

Dwi-ght opened this issue Mar 10, 2025 · 0 comments

Comments

@Dwi-ght
Copy link

Dwi-ght commented Mar 10, 2025

-------------------------------------------------------------------------------------

Copyright (c) 2022-2025, WSO2 LLC. (https://www.wso2.com).

WSO2 LLC. licenses this file to you under the Apache License,

Version 2.0 (the "License"); you may not use this file except

in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,

software distributed under the License is distributed on an

"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

KIND, either express or implied. See the License for the

specific language governing permissions and limitations

under the License.

--------------------------------------------------------------------------------------

name: 🚀 Release

on:
push:
branches: [ master ]
paths-ignore:
- "LICENSE"
workflow_dispatch:

permissions:
contents: write
issues: write
pull-requests: write
packages: write

env:
GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN }}
SHOULD_GENERATE_CHANGESET: 'true'
BRANCH: master
IS_HOTFIX: 'false'
BOT_USERNAME: ${{ secrets.RELEASE_BOT_USER_NAME }}
BOT_EMAIL: ${{ secrets.RELEASE_BOT_EMAIL }}

jobs:
release:
name: 🚀 Release
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
maven-version: [3.8.6]
java-version: [11]
pnpm-version: [8.7.4]
steps:
- name: ⬇️ Checkout
id: checkout
uses: actions/checkout@v4
with:
token: ${{ env.GH_TOKEN }}
persist-credentials: true
fetch-depth: 0

        - name: Set up Git user
          run: |
            git config user.name ${{ env.BOT_USERNAME }}
            git config user.email ${{ env.BOT_EMAIL }}

        - name: 🟢 Setup node
          id: setup-node
          uses: actions/setup-node@v4
          with:
              node-version: ${{ matrix.node-version }}

        - name: ☕ Set up JDK 11
          id: jdk-setup
          uses: actions/setup-java@v3
          with:
            java-version: ${{ matrix.java-version }}
            distribution: "adopt"
            cache: maven

        - name: 🦩 Set up Maven
          uses: stCarolas/setup-maven@v4
          id: mvn-setup
          with:
              maven-version: ${{ matrix.maven-version }}

        - name: 🥡 Setup pnpm
          uses: pnpm/action-setup@v4
          with:
              version: ${{ matrix.pnpm-version }}
              run_install: false

        - name: 🎈 Get pnpm store directory
          id: get-pnpm-cache-dir
          run: |
              echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

        - name: 🔆 Cache pnpm modules
          uses: actions/cache@v4
          id: pnpm-cache
          with:
              path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }}
              key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
              restore-keys: |
                  ${{ runner.os }}-pnpm-store-

        - name: 🧩 Install Dependencies
          id: install-dependencies
          run: pnpm install

        - name: 📝 Create settings.xml with Nexus credentials in ~/.m2
          run: |
              echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                                          http://maven.apache.org/xsd/settings-1.0.0.xsd">
                <servers>
                  <server>
                    <id>nexus-releases</id>
                    <username>${{ secrets.NEXUS_USERNAME }}</username>
                    <password>${{ secrets.NEXUS_PASSWORD }}</password>
                  </server>

                  <server>
                    <id>wso2.releases</id>
                    <username>${{ secrets.NEXUS_USERNAME }}</username>
                    <password>${{ secrets.NEXUS_PASSWORD }}</password>
                  </server>

                  <server>
                    <id>wso2.snapshots</id>
                    <username>${{ secrets.NEXUS_USERNAME }}</username>
                    <password>${{ secrets.NEXUS_PASSWORD }}</password>
                  </server>
                </servers>

                <profiles>
                  <profile>
                      <id>include-sources</id>
                      <build>
                          <plugins>
                              <plugin>
                                  <groupId>org.apache.maven.plugins</groupId>
                                  <artifactId>maven-source-plugin</artifactId>
                                  <version>3.2.1</version>
                                  <executions>
                                      <execution>
                                          <id>attach-sources</id>
                                          <goals>
                                              <goal>jar-no-fork</goal>
                                          </goals>
                                      </execution>
                                  </executions>
                              </plugin>
                          </plugins>
                      </build>
                  </profile>
                </profiles>
              </settings>' > ~/.m2/settings.xml

        - name: 💾 Cache local Maven repository
          id: cache-maven-m2
          uses: actions/cache@v4
          with:
              path: ~/.m2/repository
              key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
              restore-keys: |
                  ${{ runner.os }}-maven-

        - name: 🔍 Check GitHub API Rate Limit
          id: check-rate-limit
          run: |
            curl -s -H "Authorization: token ${{ env.GH_TOKEN }}" https://api.github.com/rate_limit | jq .

        - name: 📣 Create Release Pull Request or Publish to npm
          if: ${{ env.SHOULD_GENERATE_CHANGESET == 'true' }}
          id: changesets
          uses: changesets/[email protected]
          with:
              title: "[Release] [GitHub Action] Update package versions"
              publish: pnpm run publish:packages
              version: pnpm run version:packages
              commit: "[WSO2 Release] [GitHub Action] [Release] [skip ci] update package versions"
          env:
              GITHUB_TOKEN: ${{ env.GH_TOKEN }}

        - name: 🚀 Perform Release
          id: perform-release
          working-directory: .github/workflows
          run: |
              PACKAGES="${{ toJson(steps.changesets.outputs.publishedPackages) }}"
              bash ./scripts/release.sh "$PACKAGES" ${{ github.run_number }} ${{ env.IS_HOTFIX }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant