Update docker images to the latest tag v1.11.0-rc.1 #2857
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 | |
check-images: | |
name: Check images | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.get-tag-step.outputs.tag }} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Get tag | |
run: | | |
branch=${{ github.event.ref }} | |
echo '::set-output name=tag::'${branch#refs/heads/release/} | |
id: get-tag-step | |
- name: Check images | |
run: | | |
git fetch origin | |
git checkout origin/release/${{ steps.get-tag-step.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 | |
update-refs: | |
name: Update References to the latest tag | |
needs: check-images | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ needs.check-images.outputs.tag }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.ref }} | |
- name: Update references | |
run: | | |
sed -r -i '/github.com\/networkservicemesh\/deployments-k8s/ s/(\?ref=[a-z0-9.]*)/\?ref='"${{ needs.check-images.outputs.tag }}"'/g' `grep '?ref=' -rl *` | |
sed -r -i '/raw.githubusercontent.com\/networkservicemesh\/deployments-k8s/ s/(deployments-k8s\/[a-z0-9.]*)/deployments-k8s\/'"${{ needs.check-images.outputs.tag }}"'/g' `grep 'raw.githubusercontent.com' -rl *` | |
git config --global user.email "[email protected]" | |
git config --global user.name "NSMBot" | |
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: update-refs | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ needs.update-refs.outputs.tag }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{github.event.ref}} | |
- name: Push tag ${{ needs.update-refs.outputs.tag }} | |
run: | | |
git status | |
git tag ${{ needs.update-refs.outputs.tag }} | |
git push origin ${{ needs.update-refs.outputs.tag }} -f | |
- name: Create release ${{ needs.update-refs.outputs.tag }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | |
with: | |
tag_name: refs/tags/${{ needs.update-refs.outputs.tag }} | |
release_name: ${{ needs.update-refs.outputs.tag }} | |
draft: false | |
prerelease: false | |
update-dependent-repositories: | |
strategy: | |
matrix: | |
repository: | |
- integration-tests | |
name: Update ${{ matrix.repository }} | |
needs: 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.create-release.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.create-release.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.create-release.outputs.tag }}" >> /tmp/commit-message | |
git commit -s -F /tmp/commit-message | |
git checkout -b release/${{ needs.create-release.outputs.tag }} | |
git push -f origin release/${{ needs.create-release.outputs.tag }} |