Translations update from Hosted Weblate #1887
Workflow file for this run
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: .NET | |
on: | |
push: | |
branches: [ dev, master, beta ] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [ dev, master, beta ] | |
env: | |
# Stop wasting time caching packages | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending usage data to Microsoft | |
# DOTNET_CLI_TELEMETRY_OPTOUT: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PROJECT_NAME: "SoundSwitch" | |
ARCH: "win-x64" | |
FRAMEWORK: "net8.0-windows" | |
NODEJS: "lts/*" | |
DOTNET: "8.0.x" | |
DOTNET_PRERELEASE: true | |
CONFIGURATION: "Nightly" | |
SENTRY_NAME: "soundswitch" | |
jobs: | |
build: | |
if: github.ref != 'refs/heads/dev' | |
runs-on: windows-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-build | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
ci: | |
- '.github/**/*.yml' | |
- 'devRelease.js' | |
SoundSwitch: | |
- 'SoundSwitch*/**' | |
node: | |
- 'package.json' | |
- name: Setup .NET | |
uses: actions/[email protected] | |
if: steps.filter.outputs.SoundSwitch == 'true' || steps.filter.outputs.ci == 'true' || github.ref == 'refs/heads/master' | |
with: | |
dotnet-version: ${{ env.DOTNET }} | |
include-prerelease: ${{ env.DOTNET_PRERELEASE }} | |
- name: Restore | |
if: steps.filter.outputs.SoundSwitch == 'true' || steps.filter.outputs.ci == 'true' || github.ref == 'refs/heads/master' | |
run: dotnet restore | |
- name: Build | |
if: steps.filter.outputs.SoundSwitch == 'true' || steps.filter.outputs.ci == 'true' || github.ref == 'refs/heads/master' | |
run: dotnet build -c Release --no-restore ${{env.PROJECT_NAME}}/${{env.PROJECT_NAME}}.csproj | |
- name: Test | |
if: steps.filter.outputs.SoundSwitch == 'true' || steps.filter.outputs.ci == 'true' || github.ref == 'refs/heads/master' | |
run: dotnet test -c Release --no-restore --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}" | |
- name: Upload test results | |
if: steps.filter.outputs.SoundSwitch == 'true' || steps.filter.outputs.ci == 'true' || github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dotnet-results-${{ matrix.dotnet-version }} | |
path: TestResults-${{ matrix.dotnet-version }} | |
# Use always() to always run this step to publish test results when there are test failures | |
- name: Setup Node.js | |
if: steps.filter.outputs.node == 'true' | |
uses: actions/[email protected] | |
with: | |
node-version: ${{env.NODEJS}} | |
- name: Cache node modules | |
if: steps.filter.outputs.node == 'true' | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: npm-cache | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Install semantic-release dependencies | |
if: steps.filter.outputs.node == 'true' | |
run: npm ci --prefer-offline --silent --cache npm-cache | |
- name: Release dry run | |
if: steps.filter.outputs.node == 'true' | |
run: npx semantic-release -d | |
changes: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-changes | |
cancel-in-progress: true | |
runs-on: ubuntu-latest | |
# Set job outputs to values from filter step | |
outputs: | |
ci: ${{ steps.filter.outputs.ci }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
ci: | |
- '.github/**/*.yml' | |
- 'SoundSwitch*/**' | |
- 'devRelease.js' | |
nightly-release: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-nightly | |
cancel-in-progress: true | |
needs: [ changes ] | |
if: github.ref == 'refs/heads/dev' && needs.changes.outputs.ci == 'true' | |
outputs: | |
devVersion: ${{ steps.devVersion.outputs.version }} | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/[email protected] | |
with: | |
dotnet-version: ${{ env.DOTNET }} | |
include-prerelease: ${{ env.DOTNET_PRERELEASE }} | |
- name: Restore | |
run: dotnet restore -r ${{ env.ARCH }} | |
- name: Tests | |
run: dotnet test -c ${{env.CONFIGURATION}} --no-restore --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}" | |
- name: Fetch tags | |
run: git fetch --tags --force | |
- name: Calculate version | |
id: devVersion | |
run: .\devVersion.ps1 | |
- name: Build pre-release | |
run: dotnet publish -c ${{env.CONFIGURATION}} --no-restore -r ${{ env.ARCH }} ${{ env.PROJECT_NAME }}\${{ env.PROJECT_NAME }}.csproj | |
- name: Set Env var from GitHub | |
uses: rlespinasse/[email protected] | |
- name: Zip Build ${{env.PROJECT_NAME}}-${{ steps.devVersion.outputs.version }} | |
run: tar caf ${{env.PROJECT_NAME}}-${{ steps.devVersion.outputs.version }}.zip -C ${{ env.PROJECT_NAME }}\bin\${{env.CONFIGURATION}}\${{ env.FRAMEWORK }}\${{ env.ARCH }}\publish\ * | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: ${{env.NODEJS}} | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: npm-cache | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
run: npm ci --prefer-offline --silent --cache npm-cache | |
- name: Upload prerelease & Notify | |
env: | |
UPLOAD_SECRET: ${{secrets.UPLOAD_SECRET}} | |
UPLOAD_PUBLIC: ${{secrets.UPLOAD_PUBLIC}} | |
UPLOAD_BUCKET: ${{env.PROJECT_NAME}} | |
run: node devRelease.js "${{ secrets.DISCORD_WEBHOOK }}" "${{ steps.devVersion.outputs.version }}" "${{env.GITHUB_REPOSITORY_OWNER_PART}}/${{env.GITHUB_REPOSITORY_NAME_PART}}" "${{env.PROJECT_NAME}}-${{ steps.devVersion.outputs.version }}.zip" | |
nightly-sentry: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-sentry | |
cancel-in-progress: true | |
needs: nightly-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Sentry Release | |
uses: getsentry/[email protected] | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{env.SENTRY_NAME}} | |
SENTRY_PROJECT: ${{env.SENTRY_NAME}} | |
with: | |
environment: Nightly | |
version: "${{env.PROJECT_NAME}}@${{ needs.nightly-release.outputs.devVersion }}" | |
master-release: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-release | |
cancel-in-progress: true | |
needs: [ build, changes ] | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: ${{env.NODEJS}} | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: npm-cache | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Install semantic-release dependencies | |
run: npm ci --prefer-offline --silent --cache npm-cache | |
- name: Release | |
run: npx semantic-release | |
- name: Latest Version | |
run: | | |
version=$(git describe --tags --abbrev=0 | cut -c 2-) | |
echo "version=$version" >> $GITHUB_OUTPUT | |
id: version | |
- name: Sentry Release | |
uses: getsentry/[email protected] | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{env.SENTRY_NAME}} | |
SENTRY_PROJECT: ${{env.SENTRY_NAME}} | |
with: | |
environment: Stable | |
version: "${{env.PROJECT_NAME}}@${{ steps.version.outputs.version }}" | |