Skip to content

Commit

Permalink
transmission version: check with SHA & allow git push to trigger buil…
Browse files Browse the repository at this point in the history
…d workflow (#2843)

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

* Create transmission-sha.txt

* update SHA for 4.0.6

* Create build-version.txt

* trigger Image Builds action on completion of Transmission Builds action

* Image Builds: ignore unnecessary paths

* transmission-version: revert to 4.0.5 for testing

* build-version: revert to 4.0.5 for testing

* transmission-sha: revert to 4.0.5 for testing
  • Loading branch information
ilike2burnthing authored Jun 22, 2024
1 parent d199602 commit 5a7bb95
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 4 deletions.
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 "[email protected]"
git config --global user.name "workflow runner"
git add upstream/transmission-sha.txt
git add upstream/transmission-version.txt
git config user.email "[email protected]"
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 "[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
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

0 comments on commit 5a7bb95

Please sign in to comment.