|
| 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 | + #Build/pack the project |
| 30 | + - name: Setup .NET |
| 31 | + uses: actions/setup-dotnet@v3.2.0 |
| 32 | + with: |
| 33 | + dotnet-version: 9.0.x |
| 34 | + |
| 35 | + - name: Restore dependencies |
| 36 | + run: dotnet restore |
| 37 | + |
| 38 | + - name: Build |
| 39 | + run: dotnet build --configuration Release /p:Version='${{ inputs.rel_version }}' --no-restore |
| 40 | + |
| 41 | + - name: Test |
| 42 | + run: dotnet test --configuration Release /p:Version='${{ inputs.rel_version }}' --no-build |
| 43 | + |
| 44 | + - name: Publish project |
| 45 | + run: dotnet publish -c Release -o publish_output |
| 46 | + |
| 47 | + - name: Zip release and calculate SHA256 checksum |
| 48 | + run: | |
| 49 | + cd publish_output |
| 50 | + release_name="release-${{ inputs.rel_version }}" |
| 51 | + zip -r ../${release_name}.zip . |
| 52 | + sha256sum ${release_name}.zip > ${release_name}.zip.sha256 |
| 53 | +
|
| 54 | + - name: Create GitHub Release and Upload Artifacts |
| 55 | + uses: ncipollo/release-action@v1 |
| 56 | + with: |
| 57 | + tag: v${{ inputs.rel_version }} |
| 58 | + name: Amazon S3 Plugin v${{ inputs.rel_version }} |
| 59 | + artifacts: release-${{ inputs.rel_version }}.zip, release-${{ inputs.rel_version }}.zip.sha256 |
| 60 | + body: "This is the v${{ inputs.rel_version }} release of Amazon S3 Storage for FlowSynx System." |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments