From a8271d878d19cd7068f18477c9f28990b34603ca Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 22 Jun 2023 20:16:43 +0200 Subject: [PATCH] .github: Introducing the Infix Release General Similar to the standard build workflow, with the following exceptions: - Sets internal variable 'ver' to ${GITHUB_REF#refs/tags/v}, for filenames and directories, ensuring the leading 'v' in the tag is dropped - Sets INFIX_RELEASE variable, for post-image.sh, to '$ver' so it creates the .img files with the same name as the tarball and directory. (RELEASE clashes with OpenSSL's release handling, breaking builds completely.) - Sets release directory + tarball to infix-$variant-$ver, where variant is one of "classic" or "" (for NETCONF). - *Skips the tests*, for now. We release from main, which should already be tested. Future releases may run a release test suite here - Each build step (matrix) uploads its artifacts, when all build steps have completed we start the release job (depends on build), which then downloads all the various artifacts before creating the GitHub release - The release notes are derived from the file ChangeLog.md. Please note, extraction of the first release notes will fail since there is no prior release marker in the file Signed-off-by: Joachim Wiberg --- .github/workflows/release.yml | 100 ++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..221ef874 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,100 @@ +name: Release General + +on: + push: + tags: + - 'v[0-9]*.*' + +jobs: + build: + if: github.repository == 'kernelkit/infix' && startsWith(github.ref, 'refs/tags/') + name: Build Infix ${{ github.ref_name }} [${{ matrix.platform }}-${{ matrix.variant }}] + runs-on: ubuntu-latest + strategy: + matrix: + platform: [aarch64, x86_64] + variant: [netconf, classic] + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: Set Release Variables + id: build + run: | + ver=${GITHUB_REF#refs/tags/v} + echo "ver=${ver}" >> $GITHUB_OUTPUT + if echo $ver | grep -qE '[0-9.]+(-alpha|-beta|-rc)[0-9]*'; then + echo "pre=true" >> $GITHUB_OUTPUT + else + echo "pre=false" >> $GITHUB_OUTPUT + fi + if [ "${{ matrix.variant }}" = "netconf" ]; then + target=${{ matrix.platform }}-${ver} + else + target=${{ matrix.platform }}-${{ matrix.variant }}-${ver} + fi + echo "dir=infix-$target" >> $GITHUB_OUTPUT + echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT + - name: Restore Cache of dl/ + uses: actions/cache@v3 + with: + path: dl/ + key: dl-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }} + restore-keys: | + dl-${{ matrix.platform }}-${{ matrix.variant }}- + dl-${{ matrix.platform }}- + dl- + - name: Restore Cache of .ccache/ + uses: actions/cache@v3 + with: + path: .ccache/ + key: ccache-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }} + restore-keys: | + ccache-${{ matrix.platform }}-${{ matrix.variant }}- + ccache-${{ matrix.platform }}- + ccache- + - name: Configure & Build + env: + INFIX_RELEASE: ${{ steps.build.outputs.ver }} + run: | + if [ "${{ matrix.variant }}" = "netconf" ]; then + target=${{ matrix.platform }}_defconfig + else + target=${{ matrix.platform }}_${{ matrix.variant }}_defconfig + fi + echo "Buildring $target ..." + make $target + make + - name: Prepare Artifact + run: | + cd output + mv images ${{ steps.build.outputs.dir }} + ln -s ${{ steps.build.outputs.dir }} images + tar chfz ${{ steps.build.outputs.tgz }} ${{ steps.build.outputs.dir }} + - uses: actions/upload-artifact@v3 + with: + path: output/${{ steps.build.outputs.tgz }} + release: + name: Release Infix ${{ github.ref_name }} + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + - name: Extract ChangeLog entry ... + run: | + awk '/-----*/{if (x == 1) exit; x=1;next}x' ChangeLog.md \ + |head -n -1 > release.md + cat release.md + - uses: ncipollo/release-action@v1 + with: + name: Infix ${{ github.ref_name }} + prerelease: ${{ needs.build.outputs.pre }} + bodyFile: release.md + artifacts: artifact/* + - name: Summary + run: | + cat <> $GITHUB_STEP_SUMMARY + # Infix ${{ github.ref_name }} Released! :rocket: + + For the public download links of this release, please see: + + EOF