transmission version: check with SHA & allow git push to trigger buil… #8
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: Transmission Builds | |
on: | |
workflow_dispatch: {} | |
push: | |
branches: | |
- dev | |
paths: | |
- "upstream/transmission-version.txt" | |
jobs: | |
build-transmission: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT }} | |
ref: dev | |
# Get latest version of Transmission | |
- name: Get Transmission version | |
run: | | |
LATEST_VERSION=$(cat upstream/transmission-version.txt) | |
echo "TBT_VERSION=$LATEST_VERSION" >> $GITHUB_ENV | |
# QEMU emulator to build for other platforms | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# Buildx automates creating the multi-arch manifest build | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Authenticate so that we can push to Docker Hub | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Generate image tag and labels | |
- name: Generate Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: haugene/transmission-builder | |
tags: type=match,pattern=(\d+.\d+.\d+),group=1,value=${{ env.TBT_VERSION }} | |
# Finally, build and push the image | |
- name: Build image | |
uses: docker/build-push-action@v5 | |
with: | |
context: upstream | |
platforms: linux/amd64,linux/arm,linux/arm64 | |
build-args: | | |
REVISION=${{ github.sha }} | |
TBT_VERSION=${{ env.TBT_VERSION }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha, scope=${{ github.workflow }} | |
cache-to: type=gha, scope=${{ github.workflow}} | |
- name: Update build-version.txt | |
run: | | |
echo "$LATEST_VERSION" > upstream/build-version.txt | |
git config --global user.email "[email protected]" | |
git config --global user.name "workflow runner" | |
git add upstream/build-version.txt | |
git config user.email "[email protected]" | |
git config user.name "Transmission-Bot" | |
git commit -m "update image build version to ${LATEST_VERSION}" | |
git push origin dev |