kubenetworks/kubevpn

View on GitHub
.github/workflows/upload_release.yml

Summary

Maintainability
Test Coverage
name: Upload_release

on:
  workflow_dispatch:
    inputs:
      url:
        description: 'github release url'
        required: true
      tag:
        description: 'latest tag'
        required: true

jobs:
  build:
    name: Create Release
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os: [ darwin, windows, linux ]
        arch: [ amd64, arm64, 386 ]
        exclude:
          - os: darwin
            arch: 386
    steps:
      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: '1.23'
          check-latest: true
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Build kubevpn
        run: |
          git tag ${{ github.event.inputs.tag }} || true
          export GitHubOAuthToken=${{ secrets.KUBEVPN_UPGRADE_OAUTH }}
          make kubevpn-${{ matrix.os }}-${{ matrix.arch }}
          SUFFIX=""
          if [ "${{ matrix.os }}" = "windows" ]; then
            SUFFIX=".exe"
          fi
          
          shasum -a 256 ./bin/kubevpn${SUFFIX} | awk '{print $1}' > checksums.txt
          zip -r kubevpn_${{ github.event.inputs.tag }}_${{ matrix.os }}_${{ matrix.arch }}.zip ./bin/kubevpn${SUFFIX} LICENSE README.md README_ZH.md checksums.txt

      - name: Upload Release Asset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.inputs.url }}
          asset_path: ./kubevpn_${{ github.event.inputs.tag }}_${{ matrix.os }}_${{ matrix.arch }}.zip
          asset_name: kubevpn_${{ github.event.inputs.tag }}_${{ matrix.os }}_${{ matrix.arch }}.zip
          asset_content_type: application/zip