mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-27 13:57:46 +00:00
ci: use tag/branch for release/ci building
This commit is contained in:
@@ -154,13 +154,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: ${{ steps.goversion.outputs.GOVER }}
|
go-version: ${{ steps.goversion.outputs.GOVER }}
|
||||||
|
|
||||||
- name: Check if CI or Release
|
|
||||||
run: |
|
|
||||||
releasetype=$(make releasetype)
|
|
||||||
echo "Release Type: $releasetype"
|
|
||||||
echo "RELEASETYPE=$releasetype" >> $GITHUB_OUTPUT
|
|
||||||
id: releasetype
|
|
||||||
|
|
||||||
- name: "Build Debian packages"
|
- name: "Build Debian packages"
|
||||||
env:
|
env:
|
||||||
GOBIN: /usr/local/bin
|
GOBIN: /usr/local/bin
|
||||||
@@ -168,7 +161,7 @@ jobs:
|
|||||||
make dpkg DEBARCH=${{ matrix.arch }}
|
make dpkg DEBARCH=${{ matrix.arch }}
|
||||||
|
|
||||||
- name: "Publish CI release to aptly"
|
- name: "Publish CI release to aptly"
|
||||||
if: steps.releasetype.outputs.RELEASETYPE == 'ci' && github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
env:
|
env:
|
||||||
APTLY_USER: ${{ secrets.APTLY_USER }}
|
APTLY_USER: ${{ secrets.APTLY_USER }}
|
||||||
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
|
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
|
||||||
@@ -176,7 +169,7 @@ jobs:
|
|||||||
./upload-artifacts.sh ci ${{ matrix.suite }}
|
./upload-artifacts.sh ci ${{ matrix.suite }}
|
||||||
|
|
||||||
- name: "Publish release to aptly"
|
- name: "Publish release to aptly"
|
||||||
if: steps.releasetype.outputs.RELEASETYPE == 'release' && github.ref == 'refs/heads/master'
|
if: startsWith(github.event.ref, 'refs/tags')
|
||||||
env:
|
env:
|
||||||
APTLY_USER: ${{ secrets.APTLY_USER }}
|
APTLY_USER: ${{ secrets.APTLY_USER }}
|
||||||
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
|
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
|
||||||
@@ -203,13 +196,6 @@ jobs:
|
|||||||
# fetch the whole repo for `git describe` to work
|
# fetch the whole repo for `git describe` to work
|
||||||
fetch-depth: 0
|
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"
|
- name: "Read go version from go.mod"
|
||||||
run: |
|
run: |
|
||||||
echo "GOVER=$(sed -n 's/^go \(.*\)/\1/p' go.mod)" >> $GITHUB_OUTPUT
|
echo "GOVER=$(sed -n 's/^go \(.*\)/\1/p' go.mod)" >> $GITHUB_OUTPUT
|
||||||
@@ -234,39 +220,25 @@ jobs:
|
|||||||
make binaries GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}
|
make binaries GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: steps.releasetype.outputs.RELEASETYPE == 'release' && github.ref == 'refs/heads/master'
|
if: startsWith(github.event.ref, 'refs/tags')
|
||||||
with:
|
with:
|
||||||
name: aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}
|
name: aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||||
path: build/aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
path: build/aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
||||||
retention-days: 90
|
compression-level: 0 # no compression
|
||||||
|
|
||||||
gh-release:
|
gh-release:
|
||||||
name: "Github Release"
|
name: "Github Release"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
needs: ci-binary-build
|
needs: ci-binary-build
|
||||||
|
if: startsWith(github.event.ref, 'refs/tags')
|
||||||
steps:
|
steps:
|
||||||
- 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"
|
- name: "Download Artifacts"
|
||||||
if: steps.releasetype.outputs.RELEASETYPE == 'release' && github.ref == 'refs/heads/master'
|
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: out/
|
path: out/
|
||||||
|
|
||||||
- name: "Release"
|
- name: "Release"
|
||||||
if: steps.releasetype.outputs.RELEASETYPE == 'release' && github.ref == 'refs/heads/master'
|
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: "out/**/aptly_*.zip"
|
files: "out/**/aptly_*.zip"
|
||||||
|
|||||||
@@ -101,11 +101,15 @@ version: ## Print aptly version
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
releasetype: # Print release type (ci/release)
|
releasetype: # Print release type (ci/release)
|
||||||
@if [ -z "`git tag --points-at HEAD`" ]; then \
|
@reltype=ci ; \
|
||||||
echo ci ; \
|
gitbranch=`git rev-parse --abbrev-ref HEAD` ; \
|
||||||
else \
|
if [ "$$gitbranch" = "HEAD" ]; then \
|
||||||
echo release ; \
|
gittag=`git describe --tags --exact-match` ;\
|
||||||
fi
|
if echo "$$gittag" | grep -q '^v[0-9]'; then \
|
||||||
|
reltype=release ; \
|
||||||
|
fi ; \
|
||||||
|
fi ; \
|
||||||
|
echo $$reltype
|
||||||
|
|
||||||
build: ## Build aptly
|
build: ## Build aptly
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
|||||||
Reference in New Issue
Block a user