Skip to content

Commit

Permalink
feat: notify api server of build (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Mar 29, 2022
1 parent 334f54a commit 9bb676e
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 7 deletions.
46 changes: 46 additions & 0 deletions .github/actions/versions/action.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .github/actions/webhook/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
60 changes: 54 additions & 6 deletions .github/workflows/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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: |
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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: |
Expand All @@ -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 }}
Expand All @@ -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 }}

0 comments on commit 9bb676e

Please sign in to comment.