|
| 1 | +name: Release kubectl plugin |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 6 | + |
| 7 | +jobs: |
| 8 | + create-release: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + outputs: |
| 11 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 12 | + tag: ${{ steps.get_tag.outputs.TAG }} |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v2 |
| 15 | + - name: Get the tag without ref |
| 16 | + id: get_tag |
| 17 | + run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//} |
| 18 | + - name: Ensure changelog file exists |
| 19 | + run: touch ./docs/changelog/${{ steps.get_tag.outputs.TAG }}.md |
| 20 | + - name: Create Release |
| 21 | + id: create_release |
| 22 | + uses: actions/create-release@v1 |
| 23 | + env: |
| 24 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 25 | + with: |
| 26 | + tag_name: ${{ github.ref }} |
| 27 | + body_path: ./docs/changelog/${{ steps.get_tag.outputs.TAG }}.md |
| 28 | + release_name: Release ${{ github.ref }} |
| 29 | + draft: false |
| 30 | + prerelease: false |
| 31 | + release-plugin: |
| 32 | + runs-on: ${{ matrix.os }} |
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + os: |
| 36 | + # - windows-latest |
| 37 | + - ubuntu-latest |
| 38 | + - macOS-latest |
| 39 | + needs: create-release |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v2 |
| 42 | + - name: Set package name |
| 43 | + id: set_package_name |
| 44 | + run: echo ::set-output name=package_name::kubectl-fdb-${{ needs.create-release.outputs.tag }}-$(echo ${RUNNER_OS} | tr [:upper:] [:lower:]).tar.gz |
| 45 | + - name: Set up Go 1.15 |
| 46 | + uses: actions/setup-go@v1 |
| 47 | + with: |
| 48 | + go-version: 1.15 |
| 49 | + - name: Get FDB client |
| 50 | + if: runner.os != 'Windows' |
| 51 | + env: |
| 52 | + FDB_VER: "6.2.28" |
| 53 | + run: | |
| 54 | + go get -v -t -d ./... |
| 55 | + if [[ "${RUNNER_OS}" == "macOS" ]];then |
| 56 | + curl --fail "https://www.foundationdb.org/downloads/${FDB_VER}/macOS/installers/FoundationDB-${FDB_VER}.pkg" -o fdb.pkg |
| 57 | + sudo installer -allowUntrusted -verbose -pkg ./fdb.pkg -target / |
| 58 | + else |
| 59 | + curl --fail "https://www.foundationdb.org/downloads/${FDB_VER}/ubuntu/installers/foundationdb-clients_${FDB_VER}-1_amd64.deb" -o fdb.deb |
| 60 | + sudo dpkg -i fdb.deb |
| 61 | + fi |
| 62 | + # - name: Get FDB client (windows-only) |
| 63 | + # if: runner.os == 'Windows' |
| 64 | + # shell: powershell |
| 65 | + # run: | |
| 66 | + # Invoke-WebRequest -OutFile fdb.msi -Uri https://www.foundationdb.org/downloads/6.2.28/windows/installers/foundationdb-6.2.28-x64.msi |
| 67 | + # msiexec /i "fdb.msi" |
| 68 | + # go get -v -t -d ./... |
| 69 | + # kubectl-mc_v0.4.0_darwin_amd64.tar.gz |
| 70 | + - name: Build |
| 71 | + run: make plugin package |
| 72 | + - name: Upload Release Asset |
| 73 | + id: upload-release-asset |
| 74 | + uses: actions/upload-release-asset@v1 |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + with: |
| 78 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 79 | + asset_path: ./bin/kubectl-fdb.tar.gz |
| 80 | + asset_name: ${{ steps.set_package_name.outputs.package_name }} |
| 81 | + asset_content_type: application/gzip |
0 commit comments