mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
CI - Added support for new update backend
This commit is contained in:
parent
a3fde60b3b
commit
fb4c8ac839
65
.github/workflows/master.yml
vendored
65
.github/workflows/master.yml
vendored
@ -76,46 +76,33 @@ jobs:
|
||||
name: artemis-${{ matrix.rid }}-${{ needs.version.outputs.version-number }}
|
||||
path: build/${{ matrix.rid }}
|
||||
|
||||
ftp:
|
||||
name: Ftp Upload
|
||||
notify:
|
||||
name: Notify Backend of build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [version, build]
|
||||
needs: build
|
||||
steps:
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: artifacts
|
||||
- name: Zip and Hash artifacts
|
||||
- name: post thing
|
||||
if: needs.build.result == 'success'
|
||||
run: |
|
||||
New-Item -ItemType "Directory" -Path ftp/
|
||||
Get-ChildItem -Directory artifacts |
|
||||
Foreach-Object -Parallel {
|
||||
Compress-Archive -Path "artifacts/$($_.Name)" -DestinationPath "ftp/$($_.Name).zip" -Verbose
|
||||
(Get-FileHash -Algorithm MD5 "ftp/$($_.Name).zip").Hash | Out-File -FilePath "ftp/$($_.Name).md5" -Verbose
|
||||
$tokenUri = "https://identity.artemis-rgb.com/connect/token"
|
||||
|
||||
$headers = @{
|
||||
"Content-Type" = "application/x-www-form-urlencoded"
|
||||
}
|
||||
shell: pwsh
|
||||
- name: Upload builds to FTP
|
||||
uses: dennisameling/ftp-upload-action@v1
|
||||
with:
|
||||
server: artemis-rgb.com
|
||||
username: ${{ secrets.FTP_USER }}
|
||||
password: ${{ secrets.FTP_PASSWORD }}
|
||||
secure: false
|
||||
local_dir: ftp/
|
||||
server_dir: /builds.artemis-rgb.com/binaries/gh-actions/${{ needs.version.outputs.version-number }}/
|
||||
# - name: Prepare Build Info
|
||||
# run: |
|
||||
# New-Item -ItemType "Directory" -Path info/
|
||||
# $buildId = ${{ needs.version.outputs.version-number }}.Split(".", 2)[1]
|
||||
# $sha = ${{ github.sha }}
|
||||
# Set-Content -Path info/latest.json -Value "{ `"BuildId`": $buildId, `"CommitSha`": `"$sha`" }"
|
||||
# shell: pwsh
|
||||
# - name: Upload Build Info to FTP
|
||||
# uses: dennisameling/ftp-upload-action@v1
|
||||
# with:
|
||||
# server: artemis-rgb.com
|
||||
# username: ${{ secrets.FTP_USER }}
|
||||
# password: ${{ secrets.FTP_PASSWORD }}
|
||||
# secure: false
|
||||
# local_dir: info/
|
||||
# server_dir: /builds.artemis-rgb.com/binaries/
|
||||
|
||||
$body = @{
|
||||
"grant_type" = "client_credentials"
|
||||
"client_id" = "github.task-runners"
|
||||
"client_secret" = "${{ secrets.UPDATE_SECRET }}"
|
||||
"scope" = "artemis-updating.releases:retrieve"
|
||||
}
|
||||
|
||||
$response = Invoke-RestMethod -Method Post -Uri $tokenUri -Body $body -Headers $headers
|
||||
$accessToken = $response.access_token
|
||||
|
||||
$apiUri = "https://updating.artemis-rgb.com/api/github/retrieve-run/${{ github.run_id }}"
|
||||
$authHeader = @{
|
||||
"Authorization" = "Bearer $accessToken"
|
||||
}
|
||||
|
||||
$updateResponse = Invoke-RestMethod -Method Post -Uri $apiUri -Headers $authHeader
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user