Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create releases with Github CLI #171

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 22 additions & 63 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,74 +12,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v2
create-release:
name: Create release

get-tag:
name: Get tag
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_branch, 'release/') }}
outputs:
tag: ${{ steps.get-tag-step.outputs.tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: refs/heads/${{github.event.workflow_run.head_branch}}
- name: Get tag
run: |
branch=${{github.event.workflow_run.head_branch}}
echo tag=${branch#release/} >> $GITHUB_OUTPUT
id: get-tag-step
- name: Push tag ${{ steps.get-tag-step.outputs.tag }}
run: |
git status
git tag ${{ steps.get-tag-step.outputs.tag }}
git push origin ${{ steps.get-tag-step.outputs.tag }} -f
- name: Create release ${{ steps.get-tag-step.outputs.tag }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
with:
tag_name: refs/tags/${{ steps.get-tag-step.outputs.tag }}
release_name: ${{ steps.get-tag-step.outputs.tag }}
draft: false
prerelease: false
update-dependent-repositories:
strategy:
matrix:
repository:
- sdk
name: Update ${{ matrix.repository }}
needs: create-release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_branch, 'release/') }}
steps:
- name: Get tag
run: |
branch=${{github.event.workflow_run.head_branch}}
echo '::set-output name=tag::'${branch#release/}
id: get-tag-step
- name: Create commit
run: |
echo "Update go.mod and go.sum to ${{ github.repository }}@${{ steps.get-tag-step.outputs.tag }}" >> /tmp/commit-message
- name: Checkout networkservicemesh/${{ matrix.repository }}
uses: actions/checkout@v2
with:
path: networkservicemesh/${{ matrix.repository }}
repository: networkservicemesh/${{ matrix.repository }}
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- uses: actions/setup-go@v1
with:
go-version: 1.20.5
- name: Update ${{ github.repository }} locally
working-directory: networkservicemesh/${{ matrix.repository }}
run: |
GOPRIVATE=github.com/networkservicemesh go get -u github.com/${{ github.repository }}@${{ steps.get-tag-step.outputs.tag }}
go mod tidy
git diff
- name: Push update to the ${{ matrix.repository }}
working-directory: networkservicemesh/${{ matrix.repository }}
run: |
echo Starting to update repositotry ${{ matrix.repository }}
git config --global user.email "nsmbot@networkservicmesh.io"
git config --global user.name "NSMBot"
git add go.mod go.sum
git commit -s -F /tmp/commit-message
git checkout -b ${{ github.event.workflow_run.head_branch }}
git push -f origin ${{ github.event.workflow_run.head_branch }}

create-release:
name: Create release
needs: get-tag
uses: networkservicemesh/.github/.github/workflows/release.yaml@main
secrets:
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}

release-dependent-repositories:
name: Release dependent repositories
needs: [get-tag, create-release]
uses: networkservicemesh/.github/.github/workflows/release-dependent-repositories.yaml@main
with:
tag: ${{ needs.get-tag.outputs.tag }}
dependent_repositories: ["sdk"]
secrets:
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
Loading