fix(api): fix potential issues with concurrent updates #574
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
name: Release | |
on: | |
push: | |
branches: [ master ] | |
tags: [ v*.*.* ] | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
jobs: | |
build-windows: | |
name: Build for Windows | |
runs-on: windows-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
- run: $env:BUILD_TAG = "-nightly" | |
if: ${{ !(startsWith(github.ref, 'refs/tags/')) }} | |
- name: Cache NuGet packages | |
uses: actions/[email protected] | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
- run: dotnet restore --locked-mode /p:Configuration="Release" | |
- name: Publish desktop application | |
run: > | |
deployment/publish.ps1 | |
"Gnomeshade.Desktop" | |
"win-x64" | |
"${{ github.run_number }}" | |
$env:BUILD_TAG | |
- name: Build installer | |
id: publish | |
run: deployment/build.ps1 "Gnomeshade.Desktop.Installer" | |
- uses: actions/[email protected] | |
with: | |
name: ${{ steps.publish.outputs.artifact-name }} | |
path: ${{ steps.publish.outputs.artifact }} | |
build-linux: | |
strategy: | |
matrix: | |
project: | |
- Gnomeshade.Desktop | |
- Gnomeshade.WebApi | |
name: Build for Linux | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: 'source/Gnomeshade.WebApi/Node/package-lock.json' | |
- run: echo "BUILD_TAG=-nightly" | |
if: ${{ !(startsWith(github.ref, 'refs/tags/')) }} | |
- name: Cache NuGet packages | |
uses: actions/[email protected] | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
- name: Publish project | |
id: publish | |
run: > | |
deployment/publish.sh | |
"${{ matrix.project }}" | |
"linux-x64" | |
"${{ github.run_number }}" | |
"-nightly" | |
- uses: actions/[email protected] | |
with: | |
name: ${{ steps.publish.outputs.artifact-name }} | |
path: ${{ steps.publish.outputs.artifact }} | |
build-deb: | |
name: Build debian package | |
needs: build-linux | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
id: download | |
with: | |
name: Gnomeshade.WebApi_linux-x64.zip | |
- name: Build debian package | |
run: > | |
deployment/debian.sh | |
"${{ steps.download.outputs.download-path }}/Gnomeshade.WebApi_linux-x64.zip" | |
"${{ github.run_number }}" | |
- uses: actions/[email protected] | |
with: | |
name: Gnomeshade.WebApi_linux-x64.deb | |
path: "**/*.deb" | |
nuget: | |
name: Publish NuGet packages | |
runs-on: ubuntu-latest | |
concurrency: release-nuget | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
- name: Cache NuGet packages | |
uses: actions/[email protected] | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
- name: Pack package | |
id: pack | |
run: deployment/pack-nightly.sh "Gnomeshade.WebApi.Client" "${{ github.run_number }}" "${{ github.ref }}" | |
- name: Push package to GitHub | |
run: > | |
dotnet nuget push "${{ steps.pack.outputs.artifact }}" | |
--api-key ${{ secrets.GITHUB_TOKEN }} | |
--source https://nuget.pkg.github.com/VMelnalksnis/index.json | |
- name: Push package to NuGet | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: > | |
dotnet nuget push "${{ steps.pack.outputs.artifact }}" | |
--api-key ${{ secrets.NUGET_KEY }} | |
--source https://api.nuget.org/v3/index.json | |
docker-release: | |
name: Build docker image | |
runs-on: ubuntu-latest | |
concurrency: release-docker-release | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/[email protected] | |
- uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: ./deployment/docker_push.sh "${{ github.run_number }}" "nightly" | |
if: ${{ !(startsWith(github.ref, 'refs/tags/')) }} | |
- run: ./deployment/docker_push.sh "${{ github.run_number }}" | |
if: ${{ (startsWith(github.ref, 'refs/tags/')) }} | |
deploy-demo: | |
name: Deploy demo app | |
needs: build-linux | |
runs-on: ubuntu-latest | |
concurrency: deploy-demo | |
timeout-minutes: 10 | |
env: | |
AZURE_APP_NAME: gnomeshade-demo | |
AZURE_APP_DOMAIN: 'https://gnomeshade-demo.azurewebsites.net/' | |
steps: | |
- uses: actions/[email protected] | |
id: download | |
with: | |
name: Gnomeshade.WebApi_linux-x64.zip | |
- run: unzip Gnomeshade.WebApi_linux-x64.zip | |
- run: rm Gnomeshade.WebApi_linux-x64.zip | |
- uses: azure/[email protected] | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_APP_NAME }} | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
package: '.' | |
- uses: azure/[email protected] | |
name: Update appservice settings | |
with: | |
inlineScript: | | |
az configure --defaults web=${{ env.AZURE_APP_NAME }} | |
az configure --defaults group=${{ secrets.AZURE_RESOURCE_GROUP }} | |
az webapp config appsettings set --settings Admin__Password="${{ secrets.DEMO_ADMIN_PASSWORD }}" | |
az webapp config appsettings set --settings ConnectionStrings__Gnomeshade="Data Source=/tmp/gnomeshade.db" | |
az webapp config appsettings set --settings Database__Provider="Sqlite" | |
az webapp config appsettings set --settings Jwt__Secret="${{ secrets.DEMO_JWT_SECRET }}" | |
az webapp config appsettings set --settings Jwt__ValidAudience="${{ env.AZURE_APP_DOMAIN }}" | |
az webapp config appsettings set --settings Jwt__ValidIssuer="${{ env.AZURE_APP_DOMAIN }}" | |
az webapp config appsettings set --settings OAuth__GitHub__ClientId="${{ secrets.DEMO_GITHUB_ID }}" | |
az webapp config appsettings set --settings OAuth__GitHub__ClientSecret="${{ secrets.DEMO_GITHUB_SECRET }}" | |
az webapp config appsettings set --settings GNOMESHADE_DEMO="true" | |
- run: wget --retry-connrefused --retry-on-http-error=502 --waitretry=5 --read-timeout=120 --timeout=120 -t 5 ${{ env.AZURE_APP_DOMAIN }} | |
create-release: | |
name: Create release | |
needs: | |
- build-windows | |
- build-linux | |
- build-deb | |
runs-on: ubuntu-latest | |
concurrency: create-release | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/[email protected] | |
id: download | |
with: | |
path: artifacts | |
- name: Upload artifact to nightly release | |
if: ${{ !(startsWith(github.ref, 'refs/tags/')) }} | |
uses: pyTooling/Actions/releaser/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: nightly | |
rm: true | |
files: | | |
${{ steps.download.outputs.download-path }}/**/*.zip | |
${{ steps.download.outputs.download-path }}/**/*.deb | |
${{ steps.download.outputs.download-path }}/**/*.msi | |
- name: Create release | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: softprops/[email protected] | |
with: | |
draft: true | |
prerelease: false | |
tag_name: ${{ github.ref_name }} | |
generate_release_notes: true | |
fail_on_unmatched_files: true | |
files: | | |
${{ steps.download.outputs.download-path }}/**/*.zip | |
${{ steps.download.outputs.download-path }}/**/*.deb | |
${{ steps.download.outputs.download-path }}/**/*.msi |