Skip to content

Commit b819f37

Browse files
committed
Update workflows to use onosproject library
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
1 parent 55579ff commit b819f37

2 files changed

Lines changed: 10 additions & 91 deletions

File tree

.github/workflows/code-scan.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,4 @@ jobs:
3636
- name: check license
3737
run: make license
3838
fossa-check:
39-
runs-on: ubuntu-latest
40-
steps:
41-
- uses: actions/checkout@v4
42-
- name: FOSSA scan
43-
uses: fossa-contrib/fossa-action@v3
44-
with:
45-
fossa-api-key: 6d304c09a3ec097ba4517724e4a4d17d
39+
uses: onosproject/.github/.github/workflows/fossa-scan.yml@main

.github/workflows/release.yml

Lines changed: 9 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -9,90 +9,15 @@ on:
99
- master
1010

1111
jobs:
12-
version-check:
12+
tag-and-release:
13+
uses: onosproject/.github/.github/workflows/tag-github.yml@main
1314
if: (github.repository_owner == 'onosproject')
14-
runs-on: ubuntu-latest
15-
outputs:
16-
valid_version: ${{ steps.version-check-step.outputs.valid_version }}
17-
dev_version: ${{ steps.dev-version-check-step.outputs.dev_version }}
18-
target_version: ${{ steps.get-target-version-step.outputs.target_version }}
19-
steps:
20-
- uses: actions/checkout@v4
21-
with:
22-
fetch-depth: 0
23-
24-
- name: check version
25-
id: version-check-step
26-
run: |
27-
make check-version; if [[ $? == 0 ]]; then echo "valid_version=true" >> $GITHUB_OUTPUT; else echo "valid_version=false" >> $GITHUB_OUTPUT; fi
28-
cat $GITHUB_OUTPUT
29-
30-
- name: check dev version
31-
id: dev-version-check-step
32-
run: |
33-
f_dev=$(./build/bin/version_check.sh is_dev)
34-
if [[ $f_dev == "true" ]]; then echo "dev_version=true" >> $GITHUB_OUTPUT; else echo "dev_version=false" >> $GITHUB_OUTPUT; fi
35-
cat $GITHUB_OUTPUT
36-
37-
- name: get target version
38-
id: get-target-version-step
39-
run: |
40-
echo "target_version=$(cat VERSION)" >> $GITHUB_OUTPUT
41-
cat $GITHUB_OUTPUT
42-
43-
tag_versions:
44-
runs-on: ubuntu-latest
45-
needs: version-check
46-
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false')
47-
steps:
48-
- uses: actions/checkout@v4
49-
with:
50-
fetch-depth: 0
51-
- name: create release using REST API
52-
run: |
53-
curl -L \
54-
-X POST \
55-
-H "Accept: application/vnd.github+json" \
56-
-H "Authorization: Bearer ${{ secrets.GH_ONOS_PAT }}" \
57-
-H "X-GitHub-Api-Version: 2022-11-28" \
58-
https://api.github.com/repos/${{ github.repository }}/releases \
59-
-d '{
60-
"tag_name": "v${{ needs.version-check.outputs.target_version }}",
61-
"target_commitish": "${{ github.event.repository.default_branch }}",
62-
"name": "v${{ needs.version-check.outputs.target_version }}",
63-
"draft": false,
64-
"prerelease": false,
65-
"generate_release_notes": true
66-
}'
15+
secrets: inherit
6716

6817
bump-up-version:
69-
runs-on: ubuntu-latest
70-
needs: version-check
71-
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false')
72-
steps:
73-
- uses: actions/checkout@v4
74-
with:
75-
fetch-depth: 0
76-
- name: increment version
77-
run: |
78-
IFS='.' read -r major minor patch <<< ${{ needs.version-check.outputs.target_version }}
79-
patch_update=$((patch+1))
80-
NEW_VERSION="$major.$minor.$patch_update-dev"
81-
echo $NEW_VERSION > VERSION
82-
echo "Updated version: $NEW_VERSION"
83-
84-
- name: Create Pull Request
85-
uses: peter-evans/create-pull-request@v6
86-
with:
87-
token: ${{ secrets.GH_ONOS_PAT }}
88-
commit-message: Update version
89-
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
90-
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
91-
signoff: true
92-
branch: version-update
93-
delete-branch: true
94-
title: Update version
95-
body: |
96-
Update VERSION file
97-
add-paths: |
98-
VERSION
18+
needs: tag-and-release
19+
if: needs.tag-and-release.outputs.changed == 'true'
20+
uses: onosproject/.github/.github/workflows/bump-version.yml@main
21+
secrets: inherit
22+
with:
23+
version: ${{ needs.tag-and-release.outputs.version }}

0 commit comments

Comments
 (0)