|
| 1 | +name: CI/CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + tags: ['v*'] |
| 7 | + pull_request: |
| 8 | + branches: [master] |
| 9 | + |
| 10 | +env: |
| 11 | + DOTNET_VERSION: | |
| 12 | + 8.0.x |
| 13 | + 10.0.x |
| 14 | + DOTNET_NOLOGO: true |
| 15 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: Setup .NET |
| 27 | + uses: actions/setup-dotnet@v4 |
| 28 | + with: |
| 29 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 30 | + |
| 31 | + - name: Restore dependencies |
| 32 | + run: dotnet restore |
| 33 | + |
| 34 | + - name: Cache CLDR data |
| 35 | + uses: actions/cache@v4 |
| 36 | + with: |
| 37 | + path: ${{ runner.temp }}/rh-messageformat-cldr |
| 38 | + key: cldr-data-${{ hashFiles('src/scripts/sync-cldr.sh') }} |
| 39 | + restore-keys: | |
| 40 | + cldr-data- |
| 41 | +
|
| 42 | + - name: Generate CLDR locale data |
| 43 | + run: | |
| 44 | + chmod +x src/scripts/sync-cldr.sh |
| 45 | + ./src/scripts/sync-cldr.sh --working-dir "${{ runner.temp }}/rh-messageformat-cldr" |
| 46 | + shell: bash |
| 47 | + |
| 48 | + - name: Build |
| 49 | + run: dotnet build --configuration Release --no-restore |
| 50 | + |
| 51 | + - name: Test |
| 52 | + run: dotnet test --configuration Release --no-build --verbosity normal |
| 53 | + |
| 54 | + publish: |
| 55 | + needs: build |
| 56 | + runs-on: ubuntu-latest |
| 57 | + if: startsWith(github.ref, 'refs/tags/v') |
| 58 | + |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + with: |
| 62 | + fetch-depth: 0 |
| 63 | + |
| 64 | + - name: Setup .NET |
| 65 | + uses: actions/setup-dotnet@v4 |
| 66 | + with: |
| 67 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 68 | + |
| 69 | + - name: Restore dependencies |
| 70 | + run: dotnet restore |
| 71 | + |
| 72 | + - name: Cache CLDR data |
| 73 | + uses: actions/cache@v4 |
| 74 | + with: |
| 75 | + path: ${{ runner.temp }}/rh-messageformat-cldr |
| 76 | + key: cldr-data-${{ hashFiles('src/scripts/sync-cldr.sh') }} |
| 77 | + restore-keys: | |
| 78 | + cldr-data- |
| 79 | +
|
| 80 | + - name: Generate CLDR locale data |
| 81 | + run: | |
| 82 | + chmod +x src/scripts/sync-cldr.sh |
| 83 | + ./src/scripts/sync-cldr.sh --working-dir "${{ runner.temp }}/rh-messageformat-cldr" |
| 84 | + shell: bash |
| 85 | + |
| 86 | + - name: Extract version from tag |
| 87 | + id: version |
| 88 | + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 89 | + |
| 90 | + - name: Pack |
| 91 | + run: dotnet pack --configuration Release -p:PackageVersion=${{ steps.version.outputs.VERSION }} --output ./nupkgs |
| 92 | + |
| 93 | + - name: Push to NuGet |
| 94 | + run: dotnet nuget push ./nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |
0 commit comments