|
| 1 | +name: Release plugin |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + rel_version: |
| 7 | + description: 'Release version (examples: 1.9.0-rc.1, 1.9.1)' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + |
| 11 | +env: |
| 12 | + DOTNET_VERSION: '9.0.x' |
| 13 | + ARTIFACT_DIR: ./release |
| 14 | + PUBLISH_DIR: ${{ github.workspace }}/publish |
| 15 | + DIST_DIR: ${{ github.workspace }}/dist |
| 16 | + DOWNLOAD_DIR: ./downloaded-artifacts |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v2 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + - name: Setup .NET |
| 29 | + |
| 30 | + with: |
| 31 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 32 | + |
| 33 | + - name: Restore dependencies |
| 34 | + run: dotnet restore |
| 35 | + |
| 36 | + - name: Build solution |
| 37 | + run: dotnet build --configuration Release /p:Version='${{ inputs.rel_version }}' --no-restore |
| 38 | + |
| 39 | + - name: Run tests |
| 40 | + run: dotnet test --configuration Release /p:Version='${{ inputs.rel_version }}' --no-build |
| 41 | + |
| 42 | + - name: Publish project |
| 43 | + run: dotnet publish src/FlowSynx.Plugins.PostgreSql.csproj -c Release -o "${{ env.PUBLISH_DIR }}" |
| 44 | + |
| 45 | + - name: Package release artifacts |
| 46 | + run: | |
| 47 | + mkdir -p "${{ env.DIST_DIR }}" |
| 48 | + cd "${{ env.PUBLISH_DIR }}" |
| 49 | + 7z a -tzip "${{ env.DIST_DIR }}/flowsynx.postgresql.${{ inputs.rel_version }}.zip" * |
| 50 | +
|
| 51 | + - name: Upload release artifacts |
| 52 | + uses: actions/upload-artifact@v4 |
| 53 | + with: |
| 54 | + name: uploaded-artifacts |
| 55 | + path: ${{ env.DIST_DIR }} |
| 56 | + |
| 57 | + release: |
| 58 | + runs-on: ubuntu-latest |
| 59 | + needs: build |
| 60 | + if: github.ref == 'refs/heads/master' |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Download release artifacts |
| 64 | + uses: actions/download-artifact@v4 |
| 65 | + with: |
| 66 | + name: uploaded-artifacts |
| 67 | + path: ${{ env.DOWNLOAD_DIR }} |
| 68 | + |
| 69 | + - name: Generate SHA256 checksums |
| 70 | + run: | |
| 71 | + cd "${{ env.DOWNLOAD_DIR }}" |
| 72 | + for file in *; do sha256sum -b "$file" > "$file.sha256"; done |
| 73 | + cd - |
| 74 | +
|
| 75 | + - name: Create GitHub Release |
| 76 | + uses: ncipollo/release-action@v1 |
| 77 | + with: |
| 78 | + tag: v${{ inputs.rel_version }} |
| 79 | + name: PostgreSql Plugin v${{ inputs.rel_version }} |
| 80 | + artifacts: "${{ env.DOWNLOAD_DIR }}/**/*.*" |
| 81 | + body: | |
| 82 | + This is the v${{ inputs.rel_version }} release of the PostgreSql plugin for FlowSynx System. |
| 83 | + token: ${{ secrets.GH_TOKEN }} |
| 84 | + |
| 85 | + create-branch: |
| 86 | + runs-on: ubuntu-latest |
| 87 | + needs: [build, release] |
| 88 | + if: github.ref == 'refs/heads/master' |
| 89 | + |
| 90 | + steps: |
| 91 | + - name: Checkout repository |
| 92 | + uses: actions/checkout@v2 |
| 93 | + with: |
| 94 | + fetch-depth: 0 |
| 95 | + |
| 96 | + - name: Create release branch |
| 97 | + uses: peterjgrainger/[email protected] |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 100 | + with: |
| 101 | + branch: release-${{ inputs.rel_version }} |
| 102 | + sha: ${{ github.sha }} |
0 commit comments