|
| 1 | +name: Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["PR Checks"] |
| 6 | + types: |
| 7 | + - completed |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +jobs: |
| 13 | + |
| 14 | + build: |
| 15 | + runs-on: windows-latest |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v3 |
| 19 | + - name: Setup Version |
| 20 | + uses: gittools/actions/gitversion/[email protected] |
| 21 | + with: |
| 22 | + versionSpec: '5.12.0' |
| 23 | + - name: Restore Packages |
| 24 | + run: dotnet restore src\LicenseClearingTool.sln |
| 25 | + - name: Build |
| 26 | + run: dotnet build src\LicenseClearingTool.sln |
| 27 | + - name: Upload artifact |
| 28 | + uses: actions/upload-artifact@v4 |
| 29 | + with: |
| 30 | + name: buildoutput |
| 31 | + path: ${{ github.workspace }}/out/net8.0 |
| 32 | + |
| 33 | + build-docker: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + needs: build |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v3 |
| 39 | + - name: Download Build Output |
| 40 | + uses: actions/download-artifact@v4 |
| 41 | + with: |
| 42 | + name: buildoutput |
| 43 | + path: ${{ github.workspace }}/out/net8.0 |
| 44 | + - name: Build the Docker image |
| 45 | + run: | |
| 46 | + docker build . --file Dockerfile --tag ${{ github.repository }}:continuous-clearing-v7.0.2 |
| 47 | + docker save ${{ github.repository }}:continuous-clearing-v7.0.2 -o continuous-clearing-v7.0.2.tar |
| 48 | + - name: Upload Docker Image |
| 49 | + uses: actions/upload-artifact@v4 |
| 50 | + with: |
| 51 | + name: docker-continuous-clearing |
| 52 | + path: "*.tar" |
| 53 | + |
| 54 | + release: |
| 55 | + if: github.ref == 'refs/heads/main' |
| 56 | + runs-on: windows-latest |
| 57 | + needs: [build, build-docker] |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Checkout |
| 61 | + uses: actions/checkout@v3 |
| 62 | + - name: Download Build Output |
| 63 | + uses: actions/download-artifact@v4 |
| 64 | + with: |
| 65 | + name: buildoutput |
| 66 | + - name: Download Docker Image |
| 67 | + uses: actions/download-artifact@v4 |
| 68 | + with: |
| 69 | + name: docker-continuous-clearing |
| 70 | + - name: Create Release |
| 71 | + id: create_release |
| 72 | + uses: actions/create-release@v1 |
| 73 | + env: |
| 74 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + with: |
| 76 | + tag_name: v7.0.2 |
| 77 | + release_name: Release v7.0.2 |
| 78 | + body: | |
| 79 | + ${{ github.event.head_commit.message }} |
| 80 | + draft: true |
| 81 | + prerelease: false |
| 82 | + - name: Upload Docker Image |
| 83 | + uses: actions/upload-release-asset@v1 |
| 84 | + env: |
| 85 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + with: |
| 87 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 88 | + asset_path: ./continuous-clearing-v7.0.2.tar |
| 89 | + asset_name: continuous-clearing-v7.0.2.tar |
| 90 | + asset_content_type: application/zip |
0 commit comments