WIP #16
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release | |
| on: | |
| push: | |
| tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] | |
| jobs: | |
| sources: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Get version number | |
| run: | | |
| VERSION_NUMBER=$(echo "${{ github.ref_name }}" | cut -c 2-) | |
| echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV | |
| - name: Create source code package | |
| run: | | |
| tar -czf partup-${{ env.VERSION_NUMBER }}.tar.gz --transform "s,^,partup-${{ env.VERSION_NUMBER }}/," --exclude-vcs --exclude-vcs-ignores .* * | |
| - name: Upload package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: partup-sources-${{ github.ref_name }} | |
| path: partup-${{ env.VERSION_NUMBER }}.tar.gz | |
| if-no-files-found: error | |
| static-build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - 'linux/amd64' | |
| - 'linux/arm/v7' | |
| - 'linux/arm64/v8' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install qemu-user-static | |
| - name: Get architecture | |
| run: | | |
| ARCH=$(echo "${{ matrix.platform }}" | cut -d / -f 2- | tr -d /) | |
| echo "ARCH=$ARCH" >> $GITHUB_ENV | |
| - name: Log in to ghcr.io | |
| uses: redhat-actions/podman-login@v1 | |
| with: | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| registry: ghcr.io | |
| - name: Prepare container for ${{ matrix.platform }} | |
| run: | | |
| podman run --name partupci -di --platform ${{ matrix.platform }} -v "$PWD":/partup -w /partup ghcr.io/phytec/partup/partup-ci:latest bash | |
| podman logs partupci | |
| podman exec -i partupci uname -a | |
| - name: Build | |
| run: | | |
| podman exec -i partupci meson setup build --buildtype=release -Dstatic-glib=true | |
| podman exec -i partupci meson compile -C build | |
| podman exec -i partupci strip -s build/partup | |
| podman cp partupci:/partup/build/partup partup | |
| mv partup partup-${{ github.ref_name }}-${{ env.ARCH }} | |
| - name: Upload binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: partup-static-build-${{ github.ref_name }}-${{ env.ARCH }} | |
| path: partup-${{ github.ref_name }}-${{ env.ARCH }} | |
| if-no-files-found: error | |
| debian-package: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - 'linux/amd64' | |
| - 'linux/arm64/v8' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install qemu-user-static | |
| - name: Get version number | |
| run: | | |
| VERSION_NUMBER=$(echo "${{ github.ref_name }}" | cut -c 2-) | |
| echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV | |
| - name: Get architecture | |
| run: | | |
| ARCH=$(echo "${{ matrix.platform }}" | cut -d / -f 2- | tr -d /) | |
| echo "ARCH=$ARCH" >> $GITHUB_ENV | |
| - name: Log in to ghcr.io | |
| uses: redhat-actions/podman-login@v1 | |
| with: | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| registry: ghcr.io | |
| - name: Prepare container for ${{ matrix.platform }} | |
| run: | | |
| podman run --name partupci -di --platform ${{ matrix.platform }} -v "$PWD":/partup -w /partup ghcr.io/phytec/partup/partup-ci:latest bash | |
| podman logs partupci | |
| podman exec -i partupci uname -a | |
| podman exec -i partupci touch foo | |
| podman exec -i partupci touch ../bar | |
| podman exec -i partupci ls -la | |
| podman exec -i partupci ls -la .. | |
| podman exec -i partupci ls -la / | |
| - name: Build | |
| run: | | |
| podman exec -i partupci tar -czf ../partup_${{ env.VERSION_NUMBER }}.orig.tar.gz . | |
| podman exec -i partupci ls -la | |
| podman exec -i partupci ls -la .. | |
| podman exec -i partupci ls -la / | |
| podman exec -i partupci dpkg-buildpackage -us -uc | |
| DEB_FILE=$(podman exec partupci sh -c "ls /*.deb" | head -n 1) | |
| podman cp partupci:$DEB_FILE . | |
| echo "DEB_FILE=$(basename $DEB_FILE)" >> $GITHUB_ENV | |
| - name: Upload binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: partup-debian-package-${{ github.ref_name }}-${{ env.ARCH }} | |
| path: ${{ env.DEB_FILE }} | |
| if-no-files-found: error | |
| create-release: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - sources | |
| - static-build | |
| - debian-package | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install changelog conversion tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install pandoc | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Get version number | |
| run: | | |
| VERSION_NUMBER=$(echo "${{ github.ref_name }}" | cut -c 2-) | |
| echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV | |
| - name: Create checksums | |
| run: | | |
| mv partup-sources-${{ github.ref_name }}/* . | |
| mv partup-static-build-${{ github.ref_name }}-*/* . | |
| mv partup-debian-package-${{ github.ref_name }}-*/* . | |
| sha256sum partup-${{ env.VERSION_NUMBER }}.tar.gz partup-${{ github.ref_name }}-* partup_*.deb > sha256sum.txt | |
| cat sha256sum.txt | |
| - name: Construct changelog for this release | |
| run: | | |
| TAGS=$(git tag --list v* | sort | tail -n 2 | cut -c 2- | sed -e "s/\./\\\./g") | |
| CURRENT_TAG=$(echo $TAGS | cut -d " " -f 2) | |
| PREVIOUS_TAG=$(echo $TAGS | cut -d " " -f 1) | |
| pandoc -f rst -t gfm -o CHANGELOG.md CHANGELOG.rst | |
| grep --color=never -Pzo "(?s)(?<=# $CURRENT_TAG\n\n).+(?=\n# +$PREVIOUS_TAG)" CHANGELOG.md > changelog-${{ github.ref_name }}.md | |
| sed -i -e "s/\x0//g" -e "1,2d" changelog-${{ github.ref_name }}.md | |
| - name: Deploy artifacts | |
| uses: softprops/action-gh-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: partup ${{ env.VERSION_NUMBER }} | |
| body_path: changelog-${{ github.ref_name }}.md | |
| files: | | |
| partup-${{ env.VERSION_NUMBER }}.tar.gz | |
| partup-${{ github.ref_name }}-* | |
| partup_*.deb | |
| sha256sum.txt |