Skip to content

Commit 612dd57

Browse files
committed
Replace standard GHA workflows with reusables
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
1 parent fbdd323 commit 612dd57

File tree

3 files changed

+35
-138
lines changed

3 files changed

+35
-138
lines changed

.github/workflows/build-test.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,7 @@ on:
1111
- master
1212

1313
jobs:
14-
build:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v4
18-
- uses: actions/setup-go@v5
19-
with:
20-
go-version-file: 'go/go.mod'
21-
- name: build
22-
run: make build
23-
test:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v4
27-
- uses: actions/setup-go@v5
28-
with:
29-
go-version-file: 'go/go.mod'
30-
- name: Unit tests
31-
run: make test
14+
build-and-test:
15+
uses: onosproject/.github/.github/workflows/go-build-test.yml@main
16+
with:
17+
go-mod-path: go/go.mod

.github/workflows/code-scan.yml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,13 @@ on:
1313

1414
jobs:
1515
version-check:
16-
runs-on: ubuntu-latest
17-
steps:
18-
- uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
21-
- name: check version
22-
run: make check-version
16+
uses: onosproject/.github/.github/workflows/version-check.yml@main
17+
2318
lint:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v4
27-
- uses: actions/setup-go@v5
28-
with:
29-
go-version-file: 'go/go.mod'
30-
- name: golang-lint
31-
run: make lint
32-
license:
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v4
36-
- name: check license
37-
run: make license
19+
uses: onosproject/.github/.github/workflows/go-lint.yml@main
20+
21+
license-check:
22+
uses: onosproject/.github/.github/workflows/license-check.yml@main
23+
3824
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
25+
uses: onosproject/.github/.github/workflows/fossa-scan.yml@main

.github/workflows/release.yml

Lines changed: 23 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -10,105 +10,36 @@ on:
1010

1111
jobs:
1212
version-check:
13-
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
13+
uses: onosproject/.github/.github/workflows/go-version-check.yml@main
2314

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
15+
get-modules:
16+
uses: onosproject/.github/.github/workflows/go-get-modules.yml@main
17+
with:
18+
go-dir: servicemodels
2919

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:
20+
tag-versions:
4421
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')
22+
needs: [version-check, get-modules]
23+
if: needs.version-check.outputs.dev_version == 'false'
24+
strategy:
25+
matrix:
26+
module: ${{ fromJson(needs.get-modules.outputs.modules) }}
4727
steps:
4828
- uses: actions/checkout@v4
4929
with:
5030
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-
}'
67-
- name: create release using REST API with go prefix for go api
68-
run: |
69-
curl -L \
70-
-X POST \
71-
-H "Accept: application/vnd.github+json" \
72-
-H "Authorization: Bearer ${{ secrets.GH_ONOS_PAT }}" \
73-
-H "X-GitHub-Api-Version: 2022-11-28" \
74-
https://api.github.com/repos/${{ github.repository }}/releases \
75-
-d '{
76-
"tag_name": "go/v${{ needs.version-check.outputs.target_version }}",
77-
"target_commitish": "${{ github.event.repository.default_branch }}",
78-
"name": "go/v${{ needs.version-check.outputs.target_version }}",
79-
"draft": false,
80-
"prerelease": false,
81-
"generate_release_notes": true
82-
}'
8331

84-
bump-up-version:
85-
runs-on: ubuntu-latest
86-
needs: version-check
87-
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false')
88-
steps:
89-
- uses: actions/checkout@v4
32+
- name: Create Github release
33+
uses: onosproject/.github/.github/actions/create-github-release-action@main
9034
with:
91-
fetch-depth: 0
92-
- name: increment version
93-
run: |
94-
IFS='.' read -r major minor patch <<< ${{ needs.version-check.outputs.target_version }}
95-
patch_update=$((patch+1))
96-
NEW_VERSION="$major.$minor.$patch_update-dev"
97-
echo $NEW_VERSION > VERSION
98-
echo "Updated version: $NEW_VERSION"
35+
version: ${{ matrix.module }}/v${{ needs.version-check.outputs.target_version }}
36+
env:
37+
GH_TOKEN: ${{ secrets.GH_ONOS_PAT }}
9938

100-
- name: Create Pull Request
101-
uses: peter-evans/create-pull-request@v6
102-
with:
103-
token: ${{ secrets.GH_ONOS_PAT }}
104-
commit-message: Update version
105-
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
106-
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
107-
signoff: true
108-
branch: version-update
109-
delete-branch: true
110-
title: Update version
111-
body: |
112-
Update VERSION file
113-
add-paths: |
114-
VERSION
39+
bump-up-version:
40+
needs: version-check
41+
if: needs.version-check.outputs.dev_version == 'false'
42+
uses: onosproject/.github/.github/workflows/bump-version.yml@main
43+
secrets: inherit
44+
with:
45+
version: ${{ needs.version-check.outputs.target_version }}

0 commit comments

Comments
 (0)