diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 050b25a9..5401ab25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -203,21 +203,28 @@ jobs: # fetch the whole repo for `git describe` to work fetch-depth: 0 + - name: "Check if CI or Release" + run: | + releasetype=$(make releasetype) + echo "Release Type: $releasetype" + echo "RELEASETYPE=$releasetype" >> $GITHUB_OUTPUT + id: releasetype + - name: "Read go version from go.mod" run: | echo "GOVER=$(sed -n 's/^go \(.*\)/\1/p' go.mod)" >> $GITHUB_OUTPUT id: goversion - - name: "Get aptly version" - run: | - echo "VERSION=$(make version)" >> $GITHUB_OUTPUT - id: releaseversion - - name: "Setup Go" uses: actions/setup-go@v3 with: go-version: ${{ steps.goversion.outputs.GOVER }} + - name: "Get aptly version" + run: | + echo "VERSION=$(make version)" >> $GITHUB_OUTPUT + id: releaseversion + - name: "Build aptly ${{ matrix.goos }}/${{ matrix.goarch }}" env: GOBIN: /usr/local/bin @@ -225,6 +232,7 @@ jobs: make binaries GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} - uses: actions/upload-artifact@v4 + if: steps.releasetype.outputs.RELEASETYPE == 'release' && github.ref == 'refs/heads/master' with: name: aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }} path: build/aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip @@ -235,13 +243,28 @@ jobs: runs-on: ubuntu-latest continue-on-error: false needs: ci-binary-build - if: startsWith(github.ref, 'refs/tags/') steps: - - name: Download Artifacts + - name: "Checkout repository" + uses: actions/checkout@v3 + with: + # fetch the whole repo for `git describe` to work + fetch-depth: 0 + + - name: "Check if CI or Release" + run: | + releasetype=$(make releasetype) + echo "Release Type: $releasetype" + echo "RELEASETYPE=$releasetype" >> $GITHUB_OUTPUT + id: releasetype + + - name: "Download Artifacts" + if: steps.releasetype.outputs.RELEASETYPE == 'release' && github.ref == 'refs/heads/master' uses: actions/download-artifact@v4 with: path: out/ - - name: Release + + - name: "Release" + if: steps.releasetype.outputs.RELEASETYPE == 'release' && github.ref == 'refs/heads/master' uses: softprops/action-gh-release@v2 with: files: "out/**/aptly_*.zip"