Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transmission version: check with SHA & allow git push to trigger build workflow #2843

Merged
merged 9 commits into from
Jun 22, 2024
10 changes: 7 additions & 3 deletions .github/workflows/check-transmission-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: dev

- name: Check for new version of Transmission
run: |
LATEST_VERSION=$(curl -L https://api.github.com/repos/transmission/transmission/releases/latest | grep tag_name | awk '{print $2}' | sed -e 's/"//g' -e 's/,//')
CURRENT_VERSION=$(cat upstream/transmission-version.txt)
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then
LATEST_SHA=$(curl -L https://api.github.com/repos/transmission/transmission/tags | tac | tac | awk '/sha/ {print $2; exit}' | sed -e 's/[",]//g')
LATEST_VERSION=$(curl -L https://api.github.com/repos/transmission/transmission/releases/latest | awk '/tag_name/ {print $2}' | sed -e 's/[",]//g')
CURRENT_SHA=$(cat upstream/transmission-sha.txt)
if [ "$LATEST_SHA" != "$CURRENT_SHA" -a -n "$LATEST_SHA" -a -n "$LATEST_VERSION" ]; then
echo "$LATEST_SHA" > upstream/transmission-sha.txt
echo "$LATEST_VERSION" > upstream/transmission-version.txt
git config --global user.email "workflow@github.com"
git config --global user.name "workflow runner"
git add upstream/transmission-sha.txt
git add upstream/transmission-version.txt
git config user.email "transmission-bot@users.noreply.github.com"
git config user.name "Transmission-Bot"
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/docker-image-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ on:
branches:
- master
- dev
paths-ignore:
- README.md
- docker-compose.yml
- mkdocs.yml
- .github/**
- docs/*
- images/*
- upstream/Dockerfile
- upstream/transmission-sha.txt
- upstream/transmission-version.txt
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/docker-transmission-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: dev

# Get latest version of Transmission
- name: Get Transmission version
Expand Down Expand Up @@ -58,3 +61,14 @@ jobs:
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 "workflow@github.com"
git config --global user.name "workflow runner"
git add upstream/build-version.txt
git config user.email "transmission-bot@users.noreply.github.com"
git config user.name "Transmission-Bot"
git commit -m "update image build version to ${LATEST_VERSION}"
git push origin dev
1 change: 1 addition & 0 deletions upstream/build-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.5
1 change: 1 addition & 0 deletions upstream/transmission-sha.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a6fe2a64aa7eca089f96006cf082a12f0cde937f
2 changes: 1 addition & 1 deletion upstream/transmission-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.6
4.0.5