-
Notifications
You must be signed in to change notification settings - Fork 35
117 lines (112 loc) · 4.08 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
name: Release
on:
workflow_run:
types:
- completed
workflows:
- "Check tag"
jobs:
print-debug-info:
name: Print debug info for Release workflow
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v2
get-tag:
name: Tag
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag-step.outputs.tag }}
steps:
- name: Tag env
run: |
branch=${{ github.event.workflow_run.head_branch }}
echo "tag=${branch#release/}" >> $GITHUB_OUTPUT
id: tag-step
check-images:
name: Check images
needs: get-tag
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: release/${{ needs.get-tag.outputs.tag }}
- name: Check images are pullable
run: |
images=$(grep -roh 'apps' -e "ghcr\.io\/networkservicemesh\/.*:${{ needs.get-tag.outputs.tag }}")
for image in $images; do
docker pull $image
done
create-release:
name: Create release
needs: [get-tag, check-images]
uses: networkservicemesh/.github/.github/workflows/release.yaml@main
secrets:
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
update-dependent-repositories:
strategy:
matrix:
repository:
- integration-tests
name: Update ${{ matrix.repository }}
needs: [get-tag, create-release]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: 1.20.5
- name: Setup envs
run: |
echo GOPATH=$GITHUB_WORKSPACE >> $GITHUB_ENV
echo GO111MODULE=on >> $GITHUB_ENV
echo $GITHUB_WORKSPACE/bin >> $GITHUB_PATH
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v2
with:
path: ${{ github.workspace }}/src/github.com/${{ github.repository }}
repository: ${{ github.repository }}
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
ref: release/${{ needs.get-tag.outputs.tag }}
- name: Install gotestmd
run: |
go install github.com/networkservicemesh/gotestmd@main
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }}
- name: Install goimports
run: |
go install golang.org/x/tools/cmd/[email protected]
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }}
- uses: actions/setup-go@v1
with:
go-version: 1.20.5
- name: Checkout networkservicemesh/${{ matrix.repository }}
uses: actions/checkout@v2
with:
path: ${{ github.workspace }}/src/github.com/networkservicemesh/${{ matrix.repository }}
repository: networkservicemesh/${{ matrix.repository }}
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- name: Update ${{ matrix.repository }} locally
working-directory: ${{ github.workspace }}/src/github.com/networkservicemesh/${{ matrix.repository }}
run: |
go generate ./...
go mod tidy
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 8
- name: Push update to the ${{ matrix.repository }}
working-directory: ${{ github.workspace }}/src/github.com/networkservicemesh/${{ matrix.repository }}
run: |
sed -r -i 's/sha = "[a-z0-9]*"/sha = "tags\/${{ needs.get-tag.outputs.tag }}"/g' extensions/base/suite.gen.go
git add -- .
echo Starting to update repositotry ${{ matrix.repository }}
if ! [ -n "$(git diff --cached --exit-code)" ]; then
echo ${{ matrix.repository }} is up to date
exit 0;
fi
git config --global user.email "[email protected]"
git config --global user.name "NSMBot"
echo "Update to ${{ github.repository }}@${{ needs.get-tag.outputs.tag }}" >> /tmp/commit-message
git commit -s -F /tmp/commit-message
git checkout -b release/${{ needs.get-tag.outputs.tag }}
git push -f origin release/${{ needs.get-tag.outputs.tag }}