|
| 1 | +name: flowctl |
| 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 | + strategy: |
| 14 | + matrix: |
| 15 | + os: ['ubuntu-latest', 'windows-latest', 'macos-latest'] |
| 16 | + os_arch: [x64, arm, arm64] |
| 17 | + include: |
| 18 | + - os: ubuntu-latest |
| 19 | + kind: linux |
| 20 | + title: linux |
| 21 | + - os: windows-latest |
| 22 | + kind: win |
| 23 | + title: windows |
| 24 | + - os: macos-latest |
| 25 | + kind: osx |
| 26 | + title: osx |
| 27 | + exclude: |
| 28 | + - os: windows-latest |
| 29 | + os_arch: arm |
| 30 | + - os: macOS-latest |
| 31 | + os_arch: arm |
| 32 | + runs-on: ${{ matrix.os }} |
| 33 | + env: |
| 34 | + ARCHIVE_OUTDIR: dist/archives |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v2 |
| 38 | + with: |
| 39 | + fetch-depth: 0 #fetch-depth is needed for GitVersion |
| 40 | + |
| 41 | + #Install and calculate the new version with GitVersion |
| 42 | + - name: Install GitVersion |
| 43 | + uses: gittools/actions/gitversion/setup@v0.9.7 |
| 44 | + with: |
| 45 | + versionSpec: 5.x |
| 46 | + - name: Determine Version |
| 47 | + uses: gittools/actions/gitversion/execute@v0.9.7 |
| 48 | + id: gitversion # step id used as reference for output values |
| 49 | + - name: Display GitVersion outputs |
| 50 | + run: | |
| 51 | + echo "Version: ${{ inputs.rel_version }}" |
| 52 | +
|
| 53 | + #Build/pack the project |
| 54 | + - name: Setup .NET |
| 55 | + uses: actions/setup-dotnet@v3.2.0 |
| 56 | + with: |
| 57 | + dotnet-version: 9.0.x |
| 58 | + |
| 59 | + - name: Publish |
| 60 | + shell: bash |
| 61 | + run: | |
| 62 | + release_name="flowpack-${{ matrix.title }}-${{ matrix.os_arch }}" |
| 63 | + dotnet publish src/FlowPack/FlowPack.csproj /property:PublishSingleFile=true /property:PublishReadyToRun=true --runtime '${{ matrix.kind }}-${{ matrix.os_arch }}' -c Release --self-contained true /property:Version='${{ inputs.rel_version }}' -o "${{github.workspace}}/$release_name" |
| 64 | + |
| 65 | + mkdir -p "${{github.workspace}}/dist" |
| 66 | + cd "${{github.workspace}}/${release_name}" |
| 67 | + if [ "${{ matrix.kind }}" == "win" ]; then |
| 68 | + 7z a -tzip "${{github.workspace}}/dist/${release_name}.zip" * |
| 69 | + else |
| 70 | + tar czvf "${{github.workspace}}/dist/${release_name}.tar.gz" * |
| 71 | + fi |
| 72 | + cd "${{github.workspace}}" |
| 73 | +
|
| 74 | + - name: Upload binaries |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: flowctl-${{ matrix.title }}-${{ matrix.os_arch }} |
| 78 | + path: "${{github.workspace}}/dist" |
| 79 | + |
| 80 | + release: |
| 81 | + runs-on: ubuntu-latest |
| 82 | + needs: build |
| 83 | + if: github.ref == 'refs/heads/master' # only run job if on the master branch |
| 84 | + env: |
| 85 | + ARTIFACT_DIR: ./release |
| 86 | + steps: |
| 87 | + #Release and add artifacts to the release |
| 88 | + - name: Download nuget package artifact |
| 89 | + uses: actions/download-artifact@v4 |
| 90 | + with: |
| 91 | + pattern: flowctl-* |
| 92 | + path: ${{ env.ARTIFACT_DIR }} |
| 93 | + merge-multiple: true |
| 94 | + - name: generate checksum files |
| 95 | + run: cd ${ARTIFACT_DIR} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd - |
| 96 | + - name: Create Release |
| 97 | + uses: ncipollo/release-action@v1 |
| 98 | + with: |
| 99 | + tag: v${{ inputs.rel_version }} |
| 100 | + name: FlowCtl v${{ inputs.rel_version }} |
| 101 | + body: "This is the v${{ inputs.rel_version }} release of FlowPack" |
| 102 | + artifacts: "**/*.*" |
| 103 | + token: ${{ secrets.GH_TOKEN }} |
| 104 | + - name: Create Branch |
| 105 | + uses: peterjgrainger/action-create-branch@v2.2.0 |
| 106 | + env: |
| 107 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 108 | + with: |
| 109 | + branch: 'release-${{ inputs.rel_version }}' |
| 110 | + sha: '${{ github.event.pull_request.head.sha }}' |
0 commit comments