Release Netclient #11
This file contains hidden or 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 Netclient | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| required: true | |
| description: "new version number" | |
| type: string | |
| jobs: | |
| release-branch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch Secrets | |
| uses: bitwarden/sm-action@v2 | |
| with: | |
| access_token: ${{ secrets.BW_PUBLIC_PIPELINE_ACCESS_TOKEN }} | |
| secrets: | | |
| 73fd78b1-23c6-446a-afdd-b16400945670 > GITHUB_TOKEN | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: deweb-services/netclient | |
| ref: develop | |
| token: ${{ env.GITHUB_TOKEN }} | |
| - name: setup go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: 1.19 | |
| - name: Create Release Branch | |
| run: | | |
| git switch -c release-${{ inputs.version }} | |
| - name: Fix go mod | |
| run: | | |
| go get github.com/gravitl/netmaker@v0.24.3 | |
| go mod tidy | |
| git commit -am 'update go mod for release' | |
| - name: Update Release Branch | |
| run: | | |
| git tag -f ${{ inputs.version }} | |
| git push origin release-${{ inputs.version }} | |
| git push origin ${{ inputs.version }} | |
| release-assets: | |
| needs: release-branch | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch Secrets | |
| uses: bitwarden/sm-action@v2 | |
| with: | |
| access_token: ${{ secrets.BW_PUBLIC_PIPELINE_ACCESS_TOKEN }} | |
| secrets: | | |
| 73fd78b1-23c6-446a-afdd-b16400945670 > GITHUB_TOKEN | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: deweb-services/netclient | |
| ref: release-${{ inputs.version }} | |
| fetch-depth: 0 | |
| - name: Get Tags | |
| run: | | |
| git fetch --force --tags | |
| - name: Setup go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: 1.19 | |
| - name: GoReleaser | |
| uses: goreleaser/goreleaser-action@v4 | |
| with: | |
| args: release --clean --release-notes release.md | |
| docker: | |
| needs: release-branch | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch Secrets | |
| uses: bitwarden/sm-action@v2 | |
| with: | |
| access_token: ${{ secrets.BW_PUBLIC_PIPELINE_ACCESS_TOKEN }} | |
| secrets: | | |
| 36f7899e-da1c-47a1-bfaa-b16300eee9f3 > REGISTRY_USER | |
| 55987f21-7148-48e2-b88c-b17f00791f98 > REGISTRY_PASSWORD | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: deweb-services/netclient | |
| ref: release-${{ inputs.version }} | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ env.REGISTRY_USER }} | |
| password: ${{ env.REGISTRY_PASSWORD }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64, linux/arm/v7 | |
| push: true | |
| tags: | | |
| deweb-services/netclient:${{ inputs.version }} | |
| deweb-services/netclient:latest | |
| pull-request: | |
| needs: release-branch | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch Secrets | |
| uses: bitwarden/sm-action@v2 | |
| with: | |
| access_token: ${{ secrets.BW_PUBLIC_PIPELINE_ACCESS_TOKEN }} | |
| secrets: | | |
| 73fd78b1-23c6-446a-afdd-b16400945670 > GITHUB_TOKEN | |
| - name: create pr | |
| env: | |
| GH_TOKEN: ${{ env.GITHUB_TOKEN }} | |
| run: | | |
| gh api --method POST \ | |
| -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' \ | |
| /repos/deweb-services/netclient/pulls \ | |
| -f title='${{ inputs.version }}' \ | |
| -f head='release-${{ inputs.version }}' \ | |
| -f base="master" |