Bump actions/cache from 4 to 5 (#38) #136
This file contains hidden or 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
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| types: [ opened, reopened, synchronize ] | |
| workflow_call: | |
| inputs: | |
| platforms: | |
| description: 'Platforms to build for' | |
| required: false | |
| type: string | |
| latest: | |
| description: 'Tag image as latest' | |
| required: false | |
| type: boolean | |
| default: false | |
| rc: | |
| description: 'Tag image as rc' | |
| required: false | |
| type: boolean | |
| default: false | |
| workflow_dispatch: | |
| name: ci-build | |
| permissions: | |
| contents: read | |
| actions: write | |
| packages: write | |
| env: | |
| DOTNET_VERSION: 10.0.x | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build-windows-maui: | |
| runs-on: windows-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET SDK ${{ env.DOTNET_VERSION }} | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install maui workload for windows | |
| run: dotnet workload install maui-windows | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: windows-maui-nuget | |
| restore-keys: | | |
| windows-maui-nuget | |
| - name: Publish OpenShock Desktop Windows | |
| run: dotnet publish Desktop/Desktop.csproj -c Release-Windows -o ./publish/Windows-Maui | |
| - name: Upload OpenShock Desktop Windows artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: OpenShock Desktop Windows MAUI | |
| path: publish/Windows-Maui/* | |
| retention-days: 1 | |
| if-no-files-found: error | |
| installer-windows-maui: | |
| runs-on: windows-latest | |
| needs: build-windows-maui | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| sparse-checkout: | | |
| Installer | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: OpenShock Desktop Windows MAUI | |
| path: publish/ | |
| - name: Install NSIS | |
| run: choco install nsis -y | |
| - name: Create nsis installer | |
| uses: joncloud/makensis-action@publish | |
| with: | |
| script-file: ${{ github.workspace }}/Installer/installer.nsi | |
| additional-plugin-paths: ${{ github.workspace }}/Installer/Plugins | |
| - name: Upload OpenShock Desktop Windows Setup | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: OpenShock_Desktop_Setup | |
| path: Installer/OpenShock_Desktop_Setup.exe | |
| retention-days: 7 | |
| if-no-files-found: error | |
| build-linux-web-containers: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/desktop | |
| flavor: | | |
| latest=false | |
| tags: | | |
| type=raw,value={{branch}},enable=${{ github.ref_type == 'branch' && github.event_name != 'pull_request' }} | |
| type=raw,value=latest,enable=${{ github.event_name == 'workflow_call' && (inputs.latest || false) }} | |
| type=raw,value=rc,enable=${{ github.event_name == 'workflow_call' && (inputs.rc || false) }} | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}}.{{minor}}.{{patch}} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: ${{ (github.event_name == 'workflow_call' && (inputs.latest || inputs.rc)) || (github.ref_protected && github.event_name != 'pull_request') }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: ${{ inputs.platforms || 'linux/amd64' }} | |
| cache-from: | | |
| type=gha | |
| cache-to: | | |
| type=gha | |
| build-linux-photino: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET SDK ${{ env.DOTNET_VERSION }} | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: linux-photino-nuget | |
| restore-keys: | | |
| linux-photino-nuget | |
| - name: Publish OpenShock Photino | |
| run: dotnet publish Desktop/Desktop.csproj -c Release-Photino -o ./publish/Photino-Linux | |
| - name: Upload OpenShock Desktop Photino Linux artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: OpenShock Desktop Photino Linux | |
| path: publish/Photino-Linux/* | |
| retention-days: 7 | |
| if-no-files-found: error |