1
0
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:
Diogo Trindade 2023-01-10 21:42:10 +00:00
parent a3fde60b3b
commit fb4c8ac839

View File

@ -76,46 +76,33 @@ jobs:
name: artemis-${{ matrix.rid }}-${{ needs.version.outputs.version-number }} name: artemis-${{ matrix.rid }}-${{ needs.version.outputs.version-number }}
path: build/${{ matrix.rid }} path: build/${{ matrix.rid }}
ftp: notify:
name: Ftp Upload name: Notify Backend of build
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [version, build] needs: build
steps: steps:
- name: Download Artifacts - name: post thing
uses: actions/download-artifact@v3 if: needs.build.result == 'success'
with:
path: artifacts
- name: Zip and Hash artifacts
run: | run: |
New-Item -ItemType "Directory" -Path ftp/ $tokenUri = "https://identity.artemis-rgb.com/connect/token"
Get-ChildItem -Directory artifacts |
Foreach-Object -Parallel { $headers = @{
Compress-Archive -Path "artifacts/$($_.Name)" -DestinationPath "ftp/$($_.Name).zip" -Verbose "Content-Type" = "application/x-www-form-urlencoded"
(Get-FileHash -Algorithm MD5 "ftp/$($_.Name).zip").Hash | Out-File -FilePath "ftp/$($_.Name).md5" -Verbose
} }
shell: pwsh
- name: Upload builds to FTP $body = @{
uses: dennisameling/ftp-upload-action@v1 "grant_type" = "client_credentials"
with: "client_id" = "github.task-runners"
server: artemis-rgb.com "client_secret" = "${{ secrets.UPDATE_SECRET }}"
username: ${{ secrets.FTP_USER }} "scope" = "artemis-updating.releases:retrieve"
password: ${{ secrets.FTP_PASSWORD }} }
secure: false
local_dir: ftp/ $response = Invoke-RestMethod -Method Post -Uri $tokenUri -Body $body -Headers $headers
server_dir: /builds.artemis-rgb.com/binaries/gh-actions/${{ needs.version.outputs.version-number }}/ $accessToken = $response.access_token
# - name: Prepare Build Info
# run: | $apiUri = "https://updating.artemis-rgb.com/api/github/retrieve-run/${{ github.run_id }}"
# New-Item -ItemType "Directory" -Path info/ $authHeader = @{
# $buildId = ${{ needs.version.outputs.version-number }}.Split(".", 2)[1] "Authorization" = "Bearer $accessToken"
# $sha = ${{ github.sha }} }
# Set-Content -Path info/latest.json -Value "{ `"BuildId`": $buildId, `"CommitSha`": `"$sha`" }"
# shell: pwsh $updateResponse = Invoke-RestMethod -Method Post -Uri $apiUri -Headers $authHeader
# - 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/