Release #3717
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 }} |