diff --git a/.github/workflows/main.yml b/.github/workflows/master.yml similarity index 69% rename from .github/workflows/main.yml rename to .github/workflows/master.yml index ccf1ccc..382ce56 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/master.yml @@ -6,10 +6,10 @@ name: Main workflow on: pull_request: branches: - - main + - master push: branches: - - main + - master jobs: doc8: @@ -49,19 +49,7 @@ jobs: - run: make linkcheck license-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: reuse lint - uses: fsfe/reuse-action@v4 + uses: onosproject/.github/.github/workflows/license-check.yml@main fossa-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: FOSSA scan - uses: fossa-contrib/fossa-action@v3 - with: - fossa-api-key: 0c3bbcdf20e157bbd487dae173751b28 \ No newline at end of file + uses: onosproject/.github/.github/workflows/fossa-scan.yml@main diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b7e62b9..a9e1dea 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,122 +9,26 @@ on: - master workflow_dispatch: - jobs: - # NOTE: Action to tag repo, publish images/documents only enabled for "onosproject" + # NOTE: Action to tag repo, publish documents only enabled for "onosproject" # CAUTION: Other actions depend on this name "tag-github" tag-github: - runs-on: ubuntu-latest - if: github.repository_owner == 'onosproject' - outputs: - changed: ${{ steps.version-change.outputs.changed }} - version: ${{ steps.version-change.outputs.version }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get changes - id: version-file - run: | - if git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep VERSION; then - echo "changed=true" >> $GITHUB_OUTPUT - else - echo "VERSION file was not changed" - fi - - - name: Validate change in version file - id: version-change - if: steps.version-file.outputs.changed == 'true' - run: | - version=$(cat VERSION) - echo "version=$version" - validate="^[0-9]+\.[0-9]+\.[0-9]+$" - if [[ $version =~ $validate ]]; then - echo "changed=true" >> $GITHUB_OUTPUT - echo "version=$version" >> $GITHUB_OUTPUT - else - echo "Version change not for release" - fi - - - name: Create release using REST API - if: steps.version-change.outputs.changed == 'true' - run: | - curl -L \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GH_ONOS_PAT }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/${{ github.repository }}/releases \ - -d '{ - "tag_name": "v${{ steps.version-change.outputs.version }}", - "target_commitish": "${{ github.event.repository.default_branch }}", - "name": "v${{ steps.version-change.outputs.version }}", - "draft": false, - "prerelease": false, - "generate_release_notes": true - }' + uses: onosproject/.github/.github/workflows/tag-github.yml@main + secrets: inherit update-version: - runs-on: ubuntu-latest needs: tag-github if: needs.tag-github.outputs.changed == 'true' - steps: - - uses: actions/checkout@v4 - - - name: Increment version - run: | - version=${{ needs.tag-github.outputs.version }} - IFS='.' read -r major minor patch <<< "$version" - minor_update=$((minor+1)) - NEW_VERSION="$major.$minor_update.$patch-dev" - echo $NEW_VERSION > VERSION - echo "Updated version: $NEW_VERSION" - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.GH_ONOS_PAT }} - commit-message: Update version - committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> - author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> - signoff: true - branch: version-update - delete-branch: true - title: Update version - body: | - Update VERSION file - add-paths: | - VERSION + uses: onosproject/.github/.github/workflows/bump-version.yml@main + secrets: inherit + with: + version: ${{ needs.tag-github.outputs.version }} publish: - runs-on: ubuntu-latest + needs: tag-github if: github.repository_owner == 'onosproject' - env: - BUILD_OUTPUT_PATH: _build/multiversion/ - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.11 - - - name: Build docs - run: make multiversion - - - name: List built files - run: ls $BUILD_OUTPUT_PATH* - - - name: rsync deployments - uses: burnett01/rsync-deployments@7.0.1 - with: - switches: -rvzh --delete-after --exclude=.git - path: $BUILD_OUTPUT_PATH - remote_path: /srv/sites/docs.sd-ran.org/ - remote_host: static.opennetworking.org - remote_user: ${{ secrets.JENKINS_USERNAME }} - remote_key: ${{ secrets.JENKINS_SSHKEY }} - remote_key_pass: ${{ secrets.JENKINS_PASSPHRASE }} \ No newline at end of file + uses: onosproject/.github/.github/workflows/docs-publish.yml@main + with: + remote_host: static.opennetworking.org + remote_path: /srv/sites/docs.sd-ran.org/ + secrets: inherit