From aa0ef890d0bcdc506904d73fdd930cae6452bc4c Mon Sep 17 00:00:00 2001 From: Tyler Auerbeck Date: Wed, 4 Aug 2021 23:13:33 -0400 Subject: [PATCH] Add Deploy GH Actions Signed-off-by: Tyler Auerbeck --- .github/workflows/build-pr.yml | 32 +++++++++++++++++++++++ .github/workflows/release.yml | 47 ++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index d35be3f4b..2b64a7eee 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -3,6 +3,10 @@ on: pull_request: branches: - main + push: + branches: + - main + jobs: build: runs-on: ubuntu-latest @@ -27,3 +31,31 @@ jobs: run: make test-style - name: Run unit tests run: make test-coverage + + canary-release: + runs-on: ubuntu-latest + needs: build + env: + AZURE_STORAGE_CONNECTION_STRING: "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" + AZURE_STORAGE_CONTAINER_NAME: "${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}" + VERSION: canary + if: ${{ github.event }} == "push" && github.ref == 'refs/heads/main' + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.16' + + - name: Build Helm Binaries + run: | + make build-cross + make dist checksum VERSION="${VERSION}" + + - name: Azure CLI Action + uses: Azure/cli@1.0.4 + with: + inlineScript: | + az storage blob upload-batch -s _dist/ -d "$AZURE_STORAGE_CONTAINER_NAME" --pattern 'helm-*' --connection-string "$AZURE_STORAGE_CONNECTION_STRING" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..96b46ebb1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: release +on: + create: + tags: + - v* + + workflow_dispatch: + inputs: + version: + description: Version + required: true + +jobs: + release: + runs-on: ubuntu-latest + env: + AZURE_STORAGE_CONNECTION_STRING: "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" + AZURE_STORAGE_CONTAINER_NAME: "${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}" + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.16' + + - name: Set Version (tag event) + run: | + echo "::set-output name=VERSION::${GITHUB_REF##*/}" + if: github.event == "create" + + - name: Set Version (dispatch event) + run: | + echo "::set-output name=VERSION::${{ github.event.inputs.version }}" + if: github.event == "workflow_dispatch" + + - name: Build Helm Binaries + run: | + make build-cross + make dist checksum VERSION="${VERSION}" + + - name: Azure CLI Action + uses: Azure/cli@1.0.4 + with: + inlineScript: | + az storage blob upload-batch -s _dist/ -d "$AZURE_STORAGE_CONTAINER_NAME" --pattern 'helm-*' --connection-string "$AZURE_STORAGE_CONNECTION_STRING"