diff --git a/.github/actions/versions/action.yaml b/.github/actions/versions/action.yaml new file mode 100644 index 0000000..019ed93 --- /dev/null +++ b/.github/actions/versions/action.yaml @@ -0,0 +1,46 @@ +name: 'Determine API Server versions' +description: 'Determine API Server versions' +inputs: + beta-branch: + description: 'Name of branch for beta builds' + required: true + default: '' + dev-branch: + description: 'Name of branch for experimental builds' + required: false + default: '' +outputs: + branch: + description: 'API Server branch' + value: ${{ steps.versions.outputs.branch }} + version: + description: 'API Server version' + value: ${{ steps.versions.outputs.version }} +runs: + using: 'composite' + steps: + - id: versions + name: Determine versions + shell: bash + run: | + if [[ "${{ github.ref }}" == refs/tags/* ]] + then + VERSION="${{ github.ref_name }}" + echo "stable release ${VERSION}" + echo ::set-output name=branch::"stable" + echo ::set-output name=version::"${VERSION}" + elif [[ "${{ github.ref }}" == refs/heads/* && "${{ github.ref_name }}" == "${{ inputs.beta-branch }}" ]] + then + VERSION=$(cat BUILD) + echo "beta build ${VERSION}" + echo ::set-output name=branch::"beta" + echo ::set-output name=version::"${VERSION}" + elif [[ "${{ github.ref }}" == refs/heads/* && "${{ github.ref_name }}" == "${{ inputs.dev-branch }}" ]] + then + VERSION=$(cat BUILD) + echo "dev build ${VERSION}" + echo ::set-output name=branch::"experimental" + echo ::set-output name=version::"${VERSION}" + else + echo "not uploading" + fi diff --git a/.github/actions/webhook/action.yaml b/.github/actions/webhook/action.yaml index 70ae55a..178c180 100644 --- a/.github/actions/webhook/action.yaml +++ b/.github/actions/webhook/action.yaml @@ -28,7 +28,6 @@ inputs: runs: using: 'composite' steps: - # Based on https://github.com/kneufeld/minio-put/blob/fe6c40f6fbade3e84926b8131b7eaf45966ff7e5/minio-put.sh - name: Upload file shell: bash run: | diff --git a/.github/workflows/node.yaml b/.github/workflows/node.yaml index 01976a7..2cffcf4 100644 --- a/.github/workflows/node.yaml +++ b/.github/workflows/node.yaml @@ -28,7 +28,6 @@ jobs: yarn dist - name: Determine files to upload - if: github.ref == 'refs/heads/master' # always publish for just the master branch id: filenames shell: bash run: | @@ -38,8 +37,14 @@ jobs: echo ::set-output name=sourcename::"electron-output/companion-satellite-x64.tar.gz" echo ::set-output name=targetname::"companion-satellite-x64-${COUNT}-${HASH}.tar.gz" + - name: Versions + if: versions + uses: ./.github/actions/s3-upload + with: + beta-branch: master + - name: Upload app - if: ${{ steps.filenames.outputs.sourcename }} + if: ${{ steps.filenames.outputs.sourcename }} && ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} uses: ./.github/actions/s3-upload with: source-filename: ${{ steps.filenames.outputs.sourcename }} @@ -49,6 +54,17 @@ jobs: access-key: ${{ secrets.S3_KEY }} secret-key: ${{ secrets.S3_SECRET }} + - name: Notify API Server' + if: ${{ steps.filenames.outputs.targetname }} && ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} + uses: ./.github/actions/webhook + with: + product: satellite + branch: ${{ steps.versions.outputs.branch }} + version: ${{ steps.versions.outputs.version }} + target: 'linux-tgz' + filename: ${{ steps.filenames.outputs.targetname }} + secret: ${{ secrets.BITFOCUS_API_PROJECT_SECRET }} + Windows-x64: runs-on: windows-latest steps: @@ -69,7 +85,6 @@ jobs: yarn dist - name: Determine files to upload - if: github.ref == 'refs/heads/master' # always publish for just the master branch id: filenames shell: bash run: | @@ -79,8 +94,14 @@ jobs: echo ::set-output name=sourcename::"electron-output/companion-satellite-x64.exe" echo ::set-output name=targetname::"companion-satellite-x64-${COUNT}-${HASH}.exe" + - name: Versions + if: versions + uses: ./.github/actions/s3-upload + with: + beta-branch: master + - name: Upload app - if: ${{ steps.filenames.outputs.sourcename }} + if: ${{ steps.filenames.outputs.sourcename }} && ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} uses: ./.github/actions/s3-upload with: source-filename: ${{ steps.filenames.outputs.sourcename }} @@ -90,6 +111,17 @@ jobs: access-key: ${{ secrets.S3_KEY }} secret-key: ${{ secrets.S3_SECRET }} + - name: Notify API Server' + if: ${{ steps.filenames.outputs.targetname }} && ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} + uses: ./.github/actions/webhook + with: + product: satellite + branch: ${{ steps.versions.outputs.branch }} + version: ${{ steps.versions.outputs.version }} + target: 'win-x64' + filename: ${{ steps.filenames.outputs.targetname }} + secret: ${{ secrets.BITFOCUS_API_PROJECT_SECRET }} + Mac-x64: runs-on: macos-latest steps: @@ -115,7 +147,6 @@ jobs: APPLEIDPASS: ${{ secrets.APPLEIDPASS }} - name: Determine files to upload - if: github.ref == 'refs/heads/master' # always publish for just the master branch id: filenames shell: bash run: | @@ -125,8 +156,14 @@ jobs: echo ::set-output name=sourcename::"electron-output/companion-satellite-x64.dmg" echo ::set-output name=targetname::"companion-satellite-x64-${COUNT}-${HASH}.dmg" + - name: Versions + if: versions + uses: ./.github/actions/s3-upload + with: + beta-branch: master + - name: Upload app - if: ${{ steps.filenames.outputs.sourcename }} + if: ${{ steps.filenames.outputs.sourcename }} && ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} uses: ./.github/actions/s3-upload with: source-filename: ${{ steps.filenames.outputs.sourcename }} @@ -135,3 +172,14 @@ jobs: bucket: ${{ secrets.S3_BUCKET }} access-key: ${{ secrets.S3_KEY }} secret-key: ${{ secrets.S3_SECRET }} + + - name: Notify API Server' + if: ${{ steps.filenames.outputs.targetname }} && ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} + uses: ./.github/actions/webhook + with: + product: satellite + branch: ${{ steps.versions.outputs.branch }} + version: ${{ steps.versions.outputs.version }} + target: 'mac-x64' + filename: ${{ steps.filenames.outputs.targetname }} + secret: ${{ secrets.BITFOCUS_API_PROJECT_SECRET }}