Publish to services
This commit is contained in:
parent
31016d5cad
commit
af8ad3e758
|
@ -5,9 +5,13 @@ name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "develop" ]
|
branches:
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
- marktest
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "develop" ]
|
branches:
|
||||||
|
- develop
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
@ -204,7 +208,7 @@ jobs:
|
||||||
binary_path: ${{ matrix.binary_path }}
|
binary_path: ${{ matrix.binary_path }}
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
if: ${{ github.ref_name == 'develop' || github.ref_name == 'main' }}
|
if: ${{ github.ref_name == 'develop' || github.ref_name == 'main' || github.ref_name == 'marktest' }}
|
||||||
needs: [backend, unit_test, unit_test_postgres, integration_test]
|
needs: [backend, unit_test, unit_test_postgres, integration_test]
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
uses: ./.github/workflows/deploy.yml
|
uses: ./.github/workflows/deploy.yml
|
||||||
|
|
|
@ -19,6 +19,12 @@ on:
|
||||||
description: 'Sonarr version'
|
description: 'Sonarr version'
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
secrets:
|
||||||
|
SERVICES_API_KEY:
|
||||||
|
required: true
|
||||||
|
SERVICES_UPDATE_URL:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
package:
|
package:
|
||||||
|
@ -66,7 +72,8 @@ jobs:
|
||||||
pattern: release_*
|
pattern: release_*
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- uses: ncipollo/release-action@v1
|
- name: Create release
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
artifacts: _artifacts/Sonarr.*
|
artifacts: _artifacts/Sonarr.*
|
||||||
commit: ${{ github.sha }}
|
commit: ${{ github.sha }}
|
||||||
|
@ -74,3 +81,56 @@ jobs:
|
||||||
name: ${{ inputs.version }}
|
name: ${{ inputs.version }}
|
||||||
prerelease: ${{ inputs.branch != 'main' }}
|
prerelease: ${{ inputs.branch != 'main' }}
|
||||||
tag: v${{ inputs.version }}
|
tag: v${{ inputs.version }}
|
||||||
|
|
||||||
|
- name: Publish to Services
|
||||||
|
shell: bash
|
||||||
|
working-directory: _artifacts
|
||||||
|
run: |
|
||||||
|
branch=${{ inputs.branch }}
|
||||||
|
version=${{ inputs.version }}
|
||||||
|
lastCommit=${{ github.sha }}
|
||||||
|
|
||||||
|
hashes="["
|
||||||
|
|
||||||
|
addHash() {
|
||||||
|
path=$1
|
||||||
|
os=$2
|
||||||
|
arch=$3
|
||||||
|
type=$4
|
||||||
|
|
||||||
|
local hash=$(sha256sum *.$version.$path | awk '{ print $1; }')
|
||||||
|
echo "{ \""Os\"": \""$os\"", \""Arch\"": \""$arch\"", \""Type\"": \""$type\"", \""Hash\"": \""$hash\"" }"
|
||||||
|
}
|
||||||
|
|
||||||
|
hashes="$hashes $(addHash "linux-arm.tar.gz" "linux" "arm" "archive")"
|
||||||
|
hashes="$hashes, $(addHash "linux-arm64.tar.gz" "linux" "arm64" "archive")"
|
||||||
|
hashes="$hashes, $(addHash "linux-x64.tar.gz" "linux" "x64" "archive")"
|
||||||
|
# hashes="$hashes, $(addHash "linux-x86.tar.gz" "linux" "x86" "archive")"
|
||||||
|
|
||||||
|
# hashes="$hashes, $(addHash "linux-musl-arm.tar.gz" "linuxmusl" "arm" "archive")"
|
||||||
|
hashes="$hashes, $(addHash "linux-musl-arm64.tar.gz" "linuxmusl" "arm64" "archive")"
|
||||||
|
hashes="$hashes, $(addHash "linux-musl-x64.tar.gz" "linuxmusl" "x64" "archive")"
|
||||||
|
|
||||||
|
hashes="$hashes, $(addHash "osx-arm64.tar.gz" "osx" "arm64" "archive")"
|
||||||
|
hashes="$hashes, $(addHash "osx-x64.tar.gz" "osx" "x64" "archive")"
|
||||||
|
|
||||||
|
hashes="$hashes, $(addHash "osx-arm64-app.zip" "osx" "arm64" "installer")"
|
||||||
|
hashes="$hashes, $(addHash "osx-x64-app.zip" "osx" "x64" "installer")"
|
||||||
|
|
||||||
|
hashes="$hashes, $(addHash "win-x64.zip" "windows" "x64" "archive")"
|
||||||
|
hashes="$hashes, $(addHash "win-x86.zip" "windows" "x86" "archive")"
|
||||||
|
|
||||||
|
hashes="$hashes, $(addHash "win-x64-installer.exe" "windows" "x64" "installer")"
|
||||||
|
hashes="$hashes, $(addHash "win-x86-installer.exe" "windows" "x86" "installer")"
|
||||||
|
|
||||||
|
hashes="$hashes, $(addHash "freebsd-x64.tar.gz" "freebsd" "x64" "archive")"
|
||||||
|
|
||||||
|
hashes="$hashes ]"
|
||||||
|
|
||||||
|
json="{\""branch\"":\""$branch\"", \""version\"":\""$version\"", \""lastCommit\"":\""$lastCommit\"", \""hashes\"":$hashes}"
|
||||||
|
url="${{ secrets.SERVICES_UPDATE_URL }}"
|
||||||
|
|
||||||
|
echo "Publishing update $version ($branch) to: $url"
|
||||||
|
echo "$json"
|
||||||
|
|
||||||
|
curl -H "Content-Type: application/json" -H "X-Api-Key: ${{ secrets.SERVICES_API_KEY }}" -X POST -d "$json" $url
|
||||||
|
|
Loading…
Reference in New Issue