From 30ecffef1d261af4513cc048c051650fac34d7ac Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani Date: Fri, 16 Dec 2022 17:50:38 +0000 Subject: [PATCH] ci: fix release pipeline Disable annotated tagged releases and just rely on GitHub release pipeline. Disable periodic builds. Add the release tag in the binary's version. Signed-off-by: Ramkumar Chinchani --- .github/workflows/build.yaml | 10 +++++++++- .github/workflows/ci.yaml | 9 ++++----- .github/workflows/release.yaml | 19 +++++++++++-------- Makefile | 2 +- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7c2ce9be..997ebfa6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -39,10 +39,18 @@ jobs: sudo apt-get install -yy autoconf automake make autogen autoconf libtool binutils git squashfs-tools libcryptsetup-dev libdevmapper-dev cryptsetup-bin squashfuse (cd /tmp && git clone https://github.com/AgentD/squashfs-tools-ng && cd squashfs-tools-ng && ./autogen.sh && ./configure --prefix=/usr && make -j2 && sudo make -j2 install && sudo ldconfig -v) (cd /tmp && git clone https://github.com/anuvu/squashfs && cd squashfs && make && sudo cp squashtool/squashtool /usr/bin) - - run: | + - if: github.event_name != 'release' || github.event.action != 'published' + name: Build and test + run: | make check PRIVILEGE_LEVEL=${{ matrix.privilege-level }} env: REGISTRY_URL: localhost:5000 + - if: github.event_name == 'release' && github.event.action == 'published' + name: Build and test released version + run: | + make check VERSION=${{ github.event.release.tag_name }}-${{ github.sha }} PRIVILEGE_LEVEL=${{ matrix.privilege-level }} + env: + REGISTRY_URL: localhost:5000 - uses: actions/cache@v3 id: restore-build with: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5df0875b..79b3bc48 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,12 +2,11 @@ name: ci on: push: + branches: + - main pull_request: - schedule: - - cron: "0 0 * * 0" # weekly - release: - types: - - published + branches: + - main jobs: build: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1d4d3f97..3a7ec17a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,9 +1,9 @@ name: "tagged-release" on: - push: - tags: - - "v*" + release: + types: + - published jobs: ci: @@ -26,9 +26,12 @@ jobs: with: path: stacker key: ${{ github.sha }} - - uses: marvinpinto/action-automatic-releases@latest + - if: github.event_name == 'release' && github.event.action == 'published' + name: Publish artifacts on releases + uses: svenstaro/upload-release-action@v2 with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - files: stacker - + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: stacker + tag: ${{ github.ref }} + overwrite: true + file_glob: true diff --git a/Makefile b/Makefile index bb4cb95d..d1190622 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ GO_SRC=$(shell find . -path ./.build -prune -false -o -name \*.go) -VERSION=$(shell git describe --tags || git rev-parse HEAD) +VERSION?=$(shell git describe --tags || git rev-parse HEAD) VERSION_FULL=$(if $(shell git status --porcelain --untracked-files=no),$(VERSION)-dirty,$(VERSION)) LXC_VERSION?=$(shell pkg-config --modversion lxc)