-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: attempt to combine the workflow
- Loading branch information
Showing
5 changed files
with
136 additions
and
197 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: 'Upload build and notify BitFocus API Server' | ||
description: 'Upload build and notify BitFocus API Server' | ||
inputs: | ||
long-version: | ||
description: 'Long version number (eg 1.0.0+1234-abcdefg)' | ||
required: true | ||
default: '' | ||
beta-branch: | ||
description: 'Name of branch for beta builds' | ||
required: true | ||
default: '' | ||
dev-branch: | ||
description: 'Name of branch for experimental builds' | ||
required: false | ||
default: '' | ||
|
||
source-filename: | ||
description: 'File to upload' | ||
required: true | ||
default: '' | ||
destination-filename: | ||
description: 'Target filename in s3' | ||
required: true | ||
default: '' | ||
host: | ||
description: 'Server endpoint' | ||
required: true | ||
default: 's3.bitfocus.io' | ||
bucket: | ||
description: 'Bucket to upload to' | ||
required: true | ||
default: '' | ||
access-key: | ||
description: 'Access Key' | ||
required: true | ||
default: '' | ||
secret-key: | ||
description: 'Secret Key' | ||
required: true | ||
default: '' | ||
|
||
product: | ||
description: 'Name of the product' | ||
required: true | ||
default: '' | ||
target: | ||
description: 'Build target (linux-img/linux-deb/linux-tgz/mac-intel/mac-arm/win-x86/win-x64)' | ||
required: true | ||
default: '' | ||
api-secret: | ||
description: 'Secret for the api server' | ||
required: true | ||
default: '' | ||
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="${{ inputs.long-version }}" | ||
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="${{ inputs.long-version }}" | ||
echo "dev build ${VERSION}" | ||
echo ::set-output name=branch::"experimental" | ||
echo ::set-output name=version::"${VERSION}" | ||
else | ||
echo "not uploading" | ||
fi | ||
- name: Download minio client | ||
if: runner.os == 'Linux' && ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} | ||
shell: bash | ||
run: | | ||
wget https://dl.min.io/client/mc/release/linux-amd64/mc | ||
chmod +x mc | ||
- name: Download minio client | ||
if: runner.os == 'Windows' && ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} | ||
shell: pwsh | ||
run: | | ||
Invoke-WebRequest -Uri "https://dl.minio.io/client/mc/release/windows-amd64/mc.exe" -OutFile "./mc" | ||
chmod +x mc | ||
- name: Download minio client | ||
if: runner.os == 'macOS' && ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} | ||
shell: bash | ||
run: | | ||
wget https://dl.min.io/client/mc/release/darwin-amd64/mc | ||
chmod +x mc | ||
- name: Upload file | ||
if: ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} | ||
shell: bash | ||
run: | | ||
./mc alias set remote/ https://${{ inputs.host }} ${{ inputs.access-key }} ${{ inputs.secret-key }} | ||
./mc cp "${{ inputs.source-filename }}" "remote/${{ inputs.bucket }}/${{ inputs.destination-filename }}" | ||
- name: Notify API Server | ||
if: ${{ steps.versions.outputs.version }} && ${{ steps.versions.outputs.branch }} | ||
shell: bash | ||
run: | | ||
curl -X 'POST' \ | ||
'https://api.bitfocus.io/v1/product/${{ inputs.product }}/package' \ | ||
-H 'accept: application/json' \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"branch": "${{ steps.versions.outputs.branch }}", | ||
"version": "${{ steps.versions.outputs.version }}", | ||
"target": "${{ inputs.target }}", | ||
"filename": "${{ inputs.destination-filename }}", | ||
"secret": "${{ inputs.api-secret }}" | ||
}' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters