From c5b2cb17c882c551221512e7d287480e1f250d52 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Thu, 28 Jan 2021 18:46:23 +0000 Subject: [PATCH] trying different github action. adding manual workflow trigger for quicker testing --- .github/workflows/deploy.yml | 64 ++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c7764bfd41..da90273ae3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,24 +1,53 @@ name: Deploy on: - release: - types: - - prereleased workflow_dispatch: inputs: + release_tag_name_input: + description: "Release Tag Name " + required: true + #release: + #types: + #- prereleased jobs: setup: runs-on: ubuntu-latest outputs: - package_version: ${{ steps.get_pkg_version.outputs.package_version }} - tag_version: ${{ steps.get_pkg_version.outputs.tag_version }} + #package_version: ${{ steps.get_pkg_version.outputs.package_version }} + #tag_version: ${{ steps.get_pkg_version.outputs.tag_version }} + package_version: ${{ steps.create_tags.outputs.package_version }} + tag_version: ${{ steps.create_tags.outputs.tag_version }} steps: - name: Checkout Repo uses: actions/checkout@v2 + - name: Create Release Vars + id: create_tags + run: | + case "${RELEASE_TAG_NAME_INPUT:0:1}" in + v) + echo "RELEASE_NAME=${RELEASE_TAG_NAME_INPUT:1}" >> $GITHUB_ENV + echo "RELEASE_TAG_NAME=$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV + echo "::set-output name=package_version::${RELEASE_TAG_NAME_INPUT:1}" + echo "::set-output name=tag_version::$RELEASE_TAG_NAME_INPUT" + ;; + [0-9]) + echo "RELEASE_NAME=$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV + echo "RELEASE_TAG_NAME=v$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV + echo "::set-output name=package_version::$RELEASE_TAG_NAME_INPUT" + echo "::set-output name=tag_version::v$RELEASE_TAG_NAME_INPUT" + ;; + *) + exit 1 + ;; + esac + env: + RELEASE_TAG_NAME_INPUT: ${{ github.event.inputs.release_tag_name_input }} + - name: Get package version + if: false id: get_pkg_version run: | TAG_VERSION=$(echo ${{ github.ref }} | cut -d "/" -f 3) @@ -86,15 +115,24 @@ jobs: env: CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }} - - name: Get choco release asset - uses: dsaltares/fetch-gh-release-asset@0.0.5 + #- name: Get choco release asset + # uses: dsaltares/fetch-gh-release-asset@0.0.5 + # with: + # version: tags/${{ env.TAG_VERSION }} + # file: bitwarden.${{ env.PKG_VERSION }}.nupkg + # env: + # PKG_VERSION: ${{ needs.setup.outputs.package_version }} + # TAG_VERSION: ${{ needs.setup.outputs.tag_version }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Test getting choco release asset - windows + uses: Xotl/cool-github-releases@v1 with: - version: tags/${{ env.TAG_VERSION }} - file: bitwarden.${{ env.PKG_VERSION }}.nupkg - env: - PKG_VERSION: ${{ needs.setup.outputs.package_version }} - TAG_VERSION: ${{ needs.setup.outputs.tag_version }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + mode: download + tag_name: ${{ env.TAG_VERSION }} + assets: bitwarden.${{ env.PKG_VERSION }}.nupkg + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Push to Chocolatey shell: pwsh