Skip to content

Commit

Permalink
feat: publish builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Mar 20, 2022
1 parent d36fbc1 commit a9572bb
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 2 deletions.
47 changes: 47 additions & 0 deletions .github/actions/s3-upload/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Upload to S3'
description: 'Upload to S3'
inputs:
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: ''
runs:
using: 'composite'
steps:
# Based on https://github.com/kneufeld/minio-put/blob/fe6c40f6fbade3e84926b8131b7eaf45966ff7e5/minio-put.sh
- name: Upload file
shell: bash
run: |
resource="/${{ inputs.bucket }}/${{ inputs.destination-filename }}"
content_type="application/octet-stream"
date=`date -R`
_signature="PUT\n\n${content_type}\n${date}\n${resource}"
signature=`echo -en ${_signature} | openssl sha1 -hmac ${{ inputs.secret-key }} -binary | base64`
curl -v -X PUT -T "${{ inputs.source-filename }}" \
--fail \
-H "Host: ${{ inputs.host }}" \
-H "Date: ${date}" \
-H "Content-Type: ${content_type}" \
-H "Authorization: AWS ${{ inputs.access-key }}:${signature}" \
https://${{ inputs.host }}${resource}
33 changes: 33 additions & 0 deletions .github/workflows/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,36 @@ jobs:
# If the commit is tagged with a version (e.g. "v1.0.0"),
# release the app after building
release: ${{ startsWith(github.ref, 'refs/tags/v') }}

- name: Determine files to upload
if: github.ref == 'refs/heads/master' # always publish for just the master branch
id: filenames
shell: bash
run: |
HASH=$(git rev-parse --short HEAD)
COUNT=$(git rev-list --count HEAD)
if [ "$RUNNER_OS" == "Windows" ]; then
echo ::set-output name=sourcename::"electron-output/companion-satellite-x64.exe"
echo ::set-output name=targetname::"companion-satellite-x64-${COUNT}-${HASH}.exe"
elif [ "$RUNNER_OS" == "macOS" ]; then
echo ::set-output name=sourcename::"electron-output/companion-satellite-x64.dmg"
echo ::set-output name=targetname::"companion-satellite-x64-${COUNT}-${HASH}.dmg"
elif [ "$RUNNER_OS" == "Linux" ]; then
echo ::set-output name=sourcename::"electron-output/companion-satellite-x64.tar.gz"
echo ::set-output name=targetname::"companion-satellite-x64-${COUNT}-${HASH}.tar.gz"
else
echo "$RUNNER_OS not supported"
exit 0
fi
- name: Upload app
if: ${{ steps.filenames.outputs.sourcename }}
uses: ./.github/actions/s3-upload
with:
source-filename: ${{ steps.filenames.outputs.sourcename }}
destination-filename: ${{ steps.filenames.outputs.targetname }}
host: ${{ secrets.S3_HOST }}
bucket: ${{ secrets.S3_BUCKET }}
access-key: ${{ secrets.S3_KEY }}
secret-key: ${{ secrets.S3_SECRET }}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@
"createStartMenuShortcut": true,
"perMachine": true,
"oneClick": false,
"allowElevation": true
"allowElevation": true,
"artifactName": "companion-satellite-x64.exe"
},
"linux": {
"target": "dir",
"target": "tar.gz",
"artifactName": "companion-satellite-${arch}.tar.gz",
"extraFiles": [
{
"from": "./node_modules/sharp/vendor/8.10.6/lib",
Expand Down

0 comments on commit a9572bb

Please sign in to comment.