build(docker): adding jq for scripting #51
This file contains 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: Publish rolling build | |
on: | |
push: | |
branches: | |
- master | |
env: | |
REPO: '${{ github.repository }}' | |
jobs: | |
docker: | |
runs-on: ${{ matrix.os }} | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: ["amd64"] | |
include: | |
- arch: amd64 | |
os: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Tag rolling release | |
run: | | |
cat BUILD.bazel | sed s/-jc+master/-jc+`date +%s`-`git rev-parse --short HEAD`/ | sed s/100master/`date +%s`.`git rev-parse --short HEAD`/ > BUILD.versioned | |
cat BUILD.versioned | |
mv BUILD.versioned BUILD.bazel | |
# - name: Set up QEMU | |
# run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sanitize repo slug | |
uses: actions/github-script@v7 | |
id: repo_slug | |
with: | |
result-encoding: string | |
script: return '${{ github.repository }}'.toLowerCase() | |
- name: Publish to GitHub Container Registry | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/${{ matrix.arch }} | |
push: true | |
tags: | | |
ghcr.io/${{ steps.repo_slug.outputs.result }}:${{ github.ref_name }}-${{ matrix.arch }} | |
- name: Extract built rTorrent artifacts from Docker image | |
run: | | |
docker buildx build --platform linux/${{ matrix.arch }} --target build -o type=tar . > ../out.tar | |
tar xvf ../out.tar root/rtorrent/dist | |
- name: Prepare distribution archive | |
run: | | |
mkdir dist-${{ matrix.arch }} | |
cp doc/rtorrent.rc doc/rtorrent@.service root/rtorrent/dist/rtorrent dist-${{ matrix.arch }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: rtorrent-linux-${{ matrix.arch }} | |
path: dist-${{ matrix.arch }}/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: rtorrent-deb-${{ matrix.arch }} | |
path: root/rtorrent/dist/rtorrent-deb.deb |