# This job can be started by a git tag or using the workflow dispatch. # # The version string *must* be of the format: vYY.MM(-alphaN|-betaN|-rcN) # # In /etc/os-release this string is used for VERSION, VERSION_ID, and # IMAGE_VERSION, with the 'v' prefix. In release artifact filenames, # and zip file directory names, the 'v' is dropped per convention. name: Release General on: push: tags: - 'v[0-9]*.*' workflow_dispatch: inputs: version: required: false type: string 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: | if [ -n "${{ inputs.version }}" ]; then ver=${{ inputs.version }} else ver=${GITHUB_REF#refs/tags/} fi echo "ver=${ver}" >> $GITHUB_OUTPUT if echo $ver | grep -qE 'v[0-9\.]+(-alpha|-beta|-rc)[0-9]*'; then echo "pre=true" >> $GITHUB_OUTPUT else echo "pre=false" >> $GITHUB_OUTPUT fi fver=${ver#v} if [ "${{ matrix.variant }}" = "netconf" ]; then target=${{ matrix.platform }}-${fver} else target=${{ matrix.platform }}-${{ matrix.variant }}-${fver} 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/checkout@v3 - uses: actions/download-artifact@v3 - name: Extract ChangeLog entry ... run: | awk '/^-----*$/{if (x == 1) exit; x=1;next}x' doc/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