Update docker images to the latest tag v1.11.1-rc.1 #2900
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: | |
push: | |
branches: | |
- "release/*" | |
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: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Tag env | |
run: | | |
branch=${{ github.event.ref }} | |
echo '::set-output name=tag::'${branch#refs/heads/release/} | |
id: tag-step | |
check-images: | |
name: Check images | |
needs: get-tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Check images | |
run: | | |
git fetch origin | |
git checkout origin/release/${{ needs.get-tag.outputs.tag }} | |
pattern="ghcr\.io\/networkservicemesh\/ci\/.*:[a-z0-9]\{7\}" | |
grep -roh 'apps' -e ${pattern} || exit 0; | |
exit 1; | |
- name: Check that images are pullable | |
run: | | |
images=$(grep -roh 'apps' -e "ghcr\.io\/networkservicemesh\/.*:v.*..*..*") | |
for image in $images; do | |
docker pull $image | |
done | |
replace-params: | |
name: Replacing release specific parameters | |
needs: [get-tag, check-images] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.ref }} | |
- name: Git config | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "NSMBot" | |
- name: Replace logging level with INFO | |
run: | | |
sed -r -i '/name: NSM_LOG_LEVEL/{ n; s/value: .*/value: INFO/g }' `grep 'NSM_LOG_LEVEL' -rl *` | |
sed -r -i 's/NSM_LOG_LEVEL: .*/NSM_LOG_LEVEL: INFO/g' `grep 'NSM_LOG_LEVEL' -rl *` | |
sed -r -i 's/NSM_LOG_LEVEL=TRACE/NSM_LOG_LEVEL=INFO/g' `grep 'NSM_LOG_LEVEL' -rl *` | |
git add -- . | |
git commit -s -m "Replace logging level with INFO" | |
- name: Update references to the latest tag | |
run: | | |
sed -r -i '/github.com\/networkservicemesh\/deployments-k8s/ s/(\?ref=[a-z0-9.]*)/\?ref='"${{ needs.get-tag.outputs.tag }}"'/g' `grep '?ref=' -rl *` | |
sed -r -i '/raw.githubusercontent.com\/networkservicemesh\/deployments-k8s/ s/(deployments-k8s\/[a-z0-9.]*)/deployments-k8s\/'"${{ needs.get-tag.outputs.tag }}"'/g' `grep 'raw.githubusercontent.com' -rl *` | |
git add -- . | |
git commit -s -m "Update references to the latest tag" | |
ref=${{ github.event.ref }} | |
git push origin ${ref#refs/heads/} | |
create-release: | |
name: Create release | |
needs: [get-tag, replace-params] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{github.event.ref}} | |
- name: Push tag ${{ needs.get-tag.outputs.tag }} | |
run: | | |
git status | |
git tag ${{ needs.get-tag.outputs.tag }} | |
git push origin ${{ needs.get-tag.outputs.tag }} -f | |
- name: Create release ${{ needs.get-tag.outputs.tag }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | |
with: | |
tag_name: refs/tags/${{ needs.get-tag.outputs.tag }} | |
release_name: ${{ needs.get-tag.outputs.tag }} | |
draft: false | |
prerelease: false | |
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/goimports@latest | |
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.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 }} |