|
1 | | -name: Build, create, and release |
| 1 | +name: Release plugin |
2 | 2 |
|
3 | | -on: |
| 3 | +on: |
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
6 | 6 | rel_version: |
7 | 7 | description: 'Release version (examples: 1.9.0-rc.1, 1.9.1)' |
8 | | - required: true |
| 8 | + required: true |
9 | 9 | type: string |
10 | 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 | + |
11 | 18 | jobs: |
12 | 19 | build: |
13 | | - runs-on: ubuntu-latest |
14 | | - env: |
15 | | - ARTIFACT_DIR: ./release |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
16 | 22 | 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" |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v2 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + - name: Setup .NET |
| 29 | + uses: actions/setup-dotnet@v3.2.0 |
| 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.Azure.Blobs.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 }}/release-${{ 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 }} |
57 | 56 |
|
58 | 57 | release: |
59 | 58 | runs-on: ubuntu-latest |
60 | 59 | needs: build |
61 | | - if: github.ref == 'refs/heads/master' # only run job if on the master branch |
62 | | - env: |
63 | | - ARTIFACT_DIR: ./downloaded-artifacts |
| 60 | + if: github.ref == 'refs/heads/master' |
| 61 | + |
64 | 62 | steps: |
65 | | - - name: Download artifacts |
| 63 | + - name: Download release artifacts |
66 | 64 | uses: actions/download-artifact@v4 |
67 | 65 | with: |
68 | 66 | name: uploaded-artifacts |
69 | | - path: ${{ env.ARTIFACT_DIR }} |
| 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 - |
70 | 74 |
|
71 | | - - name: generate checksum files |
72 | | - run: cd ${ARTIFACT_DIR} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd - |
73 | | - |
74 | 75 | - name: Create GitHub Release |
75 | 76 | uses: ncipollo/release-action@v1 |
76 | 77 | with: |
77 | 78 | tag: v${{ inputs.rel_version }} |
78 | 79 | name: Azure Blobs Plugin v${{ inputs.rel_version }} |
79 | | - artifacts: "**/*.*" |
80 | | - body: "This is the v${{ inputs.rel_version }} release of Azure Blobs Plugin for FlowSynx System." |
| 80 | + artifacts: "${{ env.DOWNLOAD_DIR }}/**/*.*" |
| 81 | + body: | |
| 82 | + This is the v${{ inputs.rel_version }} release of Azure Blobs Plugin for FlowSynx System. |
81 | 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/action-create-branch@v2.2.0 |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 100 | + with: |
| 101 | + branch: release-${{ inputs.rel_version }} |
| 102 | + sha: ${{ github.sha }} |
0 commit comments