|
| 1 | +name: Build, create, and release |
| 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 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + ARTIFACT_DIR: ./release |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + fetch-depth: 0 #fetch-depth is needed for GitVersion |
| 20 | + |
| 21 | + - name: Create Branch |
| 22 | + uses: peterjgrainger/action-create-branch@v2.2.0 |
| 23 | + env: |
| 24 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 25 | + with: |
| 26 | + branch: 'release-${{ inputs.rel_version }}' |
| 27 | + sha: '${{ github.event.pull_request.head.sha }}' |
| 28 | + |
| 29 | + - name: Setup .NET |
| 30 | + uses: actions/setup-dotnet@v3.2.0 |
| 31 | + with: |
| 32 | + dotnet-version: 9.0.x |
| 33 | + |
| 34 | + - name: Restore dependencies |
| 35 | + run: dotnet restore |
| 36 | + |
| 37 | + - name: Build |
| 38 | + run: dotnet build --configuration Release /p:Version='${{ inputs.rel_version }}' --no-restore |
| 39 | + |
| 40 | + - name: Test |
| 41 | + run: dotnet test --configuration Release /p:Version='${{ inputs.rel_version }}' --no-build |
| 42 | + |
| 43 | + - name: Publish project |
| 44 | + run: dotnet publish src/FlowSynx.Plugins.Azure.Blobs.csproj -c Release -o "${{github.workspace}}/publish" |
| 45 | + |
| 46 | + - name: Zip the output files |
| 47 | + run: | |
| 48 | + mkdir -p "${{github.workspace}}/dist" |
| 49 | + cd "${{github.workspace}}/publish" |
| 50 | + 7z a -tzip "${{github.workspace}}/dist/release-${{ inputs.rel_version }}.zip" * |
| 51 | +
|
| 52 | + - name: Upload artifacts |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: uploaded-artifacts |
| 56 | + path: "${{github.workspace}}/dist" |
| 57 | + |
| 58 | + release: |
| 59 | + runs-on: ubuntu-latest |
| 60 | + needs: build |
| 61 | + if: github.ref == 'refs/heads/master' # only run job if on the master branch |
| 62 | + env: |
| 63 | + ARTIFACT_DIR: ./downloaded-artifacts |
| 64 | + steps: |
| 65 | + - name: Download artifacts |
| 66 | + uses: actions/download-artifact@v4 |
| 67 | + with: |
| 68 | + name: uploaded-artifacts |
| 69 | + path: ${{ env.ARTIFACT_DIR }} |
| 70 | + |
| 71 | + - name: generate checksum files |
| 72 | + run: cd ${ARTIFACT_DIR} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd - |
| 73 | + |
| 74 | + - name: Create GitHub Release |
| 75 | + uses: ncipollo/release-action@v1 |
| 76 | + with: |
| 77 | + tag: v${{ inputs.rel_version }} |
| 78 | + name: Azure Blobs Plugin v${{ inputs.rel_version }} |
| 79 | + artifacts: "**/*.*" |
| 80 | + body: "This is the v${{ inputs.rel_version }} release of Azure Blobs Storage for FlowSynx System." |
| 81 | + token: ${{ secrets.GH_TOKEN }} |
0 commit comments