diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..72baa26 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,43 @@ +name: CI/CD + +on: + push: + branches: + - '*' + +jobs: + build: + + name: CI/CD + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.0.100 + + - name: Publish + working-directory: src/BlazorFileSaver.Sample + run: dotnet publish -c Release + + - name: Deploy to Test + uses: netlify/actions/cli@master + with: + args: deploy --json -d src/BlazorFileSaver.Sample/bin/Release/netstandard2.0/publish/BlazorFileSaver.Sample/dist/ + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + + - name: Deploy to Production + if: github.ref == 'refs/heads/master' + uses: netlify/actions/cli@master + with: + args: deploy --prod --json -d src/BlazorFileSaver.Sample/bin/Release/netstandard2.0/publish/BlazorFileSaver.Sample/dist/ + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ff0b2e0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Create Release + +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + build: + + name: Create Release + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.0.100 + + - name: Dotnet Pack + working-directory: src/BlazorFileSaver + run: dotnet pack -c Release -p:Version=${GITHUB_REF##*/v} + + - name: Dotnet Nuget Push + working-directory: src/BlazorFileSaver/bin/Release + run: dotnet nuget push BlazorFileSaver.*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} + continue-on-error: true + + - name: Create Release + uses: actions/create-release@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false diff --git a/src/BlazorFileSaver/BlazorFileSaver.csproj b/src/BlazorFileSaver/BlazorFileSaver.csproj index 28334a7..2184e94 100644 --- a/src/BlazorFileSaver/BlazorFileSaver.csproj +++ b/src/BlazorFileSaver/BlazorFileSaver.csproj @@ -7,12 +7,17 @@