CI: GH uses ubuntu22.04 with transmission-cli 3.0 #382
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: Build remote / local with docker | |
| on: | |
| push: | |
| workflow_dispatch: | |
| pull_request: | |
| # https://github.com/dorny/paths-filter?tab=readme-ov-file#example | |
| # https://github.com/vtnerd/monero-lws/blob/master/.github/workflows/docker-build.yml | |
| jobs: | |
| dockerbuild: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: write | |
| packages: write | |
| discussions: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| ref: ${{ github.ref }} | |
| - name: Check if we rebuild + push docker image | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| src: | |
| - 'Dockerfile' | |
| - 'submodules/mktorrent/**' | |
| - 'create_monero_torrent.sh' | |
| transmission: | |
| - '.github/workflows/docker/Dockerfile.transmission' | |
| - name: ghcr login | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: transmission-show (pull or build) | |
| run: | | |
| tag_name="ghcr.io/plowsof/monero-torrent-show:latest" | |
| case "${{ steps.changes.outputs.transmission }}" in | |
| true) | |
| docker build -f ./.github/workflows/docker/Dockerfile.transmission -t $tag_name . | |
| docker push -a ghcr.io/plowsof/monero-torrent-show | |
| ;; | |
| *) | |
| docker pull "$tag_name" || docker build -f ./.github/workflows/docker/Dockerfile.transmission -t "$tag_name" . | |
| ;; | |
| esac | |
| - name: get version from hashes.txt | |
| id: hashes_version | |
| run: | | |
| HASHES_URL="https://www.getmonero.org/downloads/hashes.txt" | |
| curl -sL $HASHES_URL -o hashes.txt | |
| VERSION=$(awk '/monero-source-v/ {print $2}' "hashes.txt" | awk -F".tar.bz2" '{print $1}' | awk -F"-" '{print $3}') | |
| VERSION_GUI=$(awk '/monero-gui-source-v/ {print $2}' "hashes.txt" | awk -F".tar.bz2" '{print $1}' | awk -F"-" '{print $4}') | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "VERSION_GUI=$VERSION_GUI" >> $GITHUB_ENV | |
| env: | |
| VERSION: $VERSION | |
| VERSION_GUI: $VERSION_GUI | |
| # note: its possible gui + cli have different versions. combine them for the key. | |
| - uses: actions/cache@v4 | |
| id: binaries_cache | |
| with: | |
| path: ./downloads | |
| key: monero-binaries-${{ env.VERSION }}-gui-${{ env.VERSION_GUI }} | |
| - if: ${{ steps.binaries_cache.outputs.cache-hit != 'true' }} | |
| name: Run remote profile | |
| run: | | |
| if [ "${{ steps.changes.outputs.src }}" = "true" ] || [ "${{ github.ref_type }}" = "tag" ]; then | |
| # force rebuild instead of pulling container. | |
| docker compose --profile remote up --build | |
| else | |
| docker compose --profile remote up | |
| fi | |
| MAGNET_LINK=$(docker run --rm -v "./watch:/watch" ghcr.io/plowsof/monero-torrent-show:latest -m /watch/monero-$VERSION.torrent) | |
| MAGNET_LINK_GUI=$(docker run --rm -v "./watch:/watch" ghcr.io/plowsof/monero-torrent-show:latest -m /watch/monero-gui-$VERSION_GUI.torrent) | |
| echo "MAGNET_LINK_REMOTE=$MAGNET_LINK" >> $GITHUB_ENV | |
| echo "MAGNET_LINK_REMOTE_GUI=$MAGNET_LINK_GUI" >> $GITHUB_ENV | |
| sudo rm ./watch/* | |
| - name: Move downloads to cdn | |
| run: | | |
| mkdir -p ./cdn | |
| sudo mv ./downloads/* ./cdn/ | |
| - name: Run local profile | |
| run: | | |
| if [ "${{ steps.changes.outputs.src }}" = "true" ] || [ "${{ github.ref_type }}" = "tag" ]; then | |
| docker compose --profile local up --build | |
| else | |
| docker compose --profile local up | |
| fi | |
| MAGNET_LINK=$(docker run --rm -v "./watch:/watch" ghcr.io/plowsof/monero-torrent-show:latest -m /watch/monero-$VERSION.torrent) | |
| MAGNET_LINK_GUI=$(docker run --rm -v "./watch:/watch" ghcr.io/plowsof/monero-torrent-show:latest -m /watch/monero-gui-$VERSION_GUI.torrent) | |
| echo "MAGNET_LINK_LOCAL=$MAGNET_LINK" >> $GITHUB_ENV | |
| echo "MAGNET_LINK_LOCAL_GUI=$MAGNET_LINK_GUI" >> $GITHUB_ENV | |
| INFOHASH="${MAGNET_LINK#*btih:}" | |
| INFOHASH="${INFOHASH%%&*}" | |
| INFOHASH_GUI="${MAGNET_LINK_GUI#*btih:}" | |
| INFOHASH_GUI="${INFOHASH_GUI%%&*}" | |
| TORRENT_URL="https://github.com/plowsof/monero-torrent/releases/download/${GITHUB_REF_NAME}/monero-${VERSION}.torrent" | |
| TORRENT_URL_GUI="https://github.com/plowsof/monero-torrent/releases/download/${GITHUB_REF_NAME}/monero-gui-${VERSION_GUI}.torrent" | |
| echo "INFOHASH=$INFOHASH" >> $GITHUB_ENV | |
| echo "INFOHASH_GUI=$INFOHASH_GUI" >> $GITHUB_ENV | |
| echo "TORRENT_URL=$TORRENT_URL" >> $GITHUB_ENV | |
| echo "TORRENT_URL_GUI=$TORRENT_URL_GUI" >> $GITHUB_ENV | |
| - name: Push new image to ghcr | |
| if: github.ref_type == 'tag' || ( steps.changes.outputs.src == 'true' && github.ref == 'refs/heads/main' ) | |
| run: docker push -a ghcr.io/plowsof/monero-torrent-build-env | |
| - if: ${{ steps.binaries_cache.outputs.cache-hit != 'true' }} | |
| name: Compare hashes for local/remote build and write summary | |
| run: | | |
| if [ "$MAGNET_LINK_REMOTE" = "$MAGNET_LINK_LOCAL" ] && [ "$MAGNET_LINK_REMOTE_GUI" = "$MAGNET_LINK_LOCAL_GUI" ]; then | |
| echo "- Magnet links match: " >> $GITHUB_STEP_SUMMARY | |
| echo ">$MAGNET_LINK_LOCAL" >> $GITHUB_STEP_SUMMARY | |
| echo ">$MAGNET_LINK_LOCAL_GUI" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "- Magnet links differ" >> $GITHUB_STEP_SUMMARY | |
| echo "Remote: $MAGNET_LINK_REMOTE" >> $GITHUB_STEP_SUMMARY | |
| echo "Local: $MAGNET_LINK_LOCAL" >> $GITHUB_STEP_SUMMARY | |
| echo "Remote GUI: $MAGNET_LINK_REMOTE_GUI" >> $GITHUB_STEP_SUMMARY | |
| echo "Local GUI: $MAGNET_LINK_LOCAL_GUI" >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi | |
| - name: create release notes | |
| run: | | |
| { | |
| echo "### CLI Torrent info" | |
| echo '```' | |
| docker run --rm -v "./watch:/watch" ghcr.io/plowsof/monero-torrent-show:latest /watch/monero-$VERSION.torrent | |
| echo '```' | |
| echo "### GUI Torrent info" | |
| echo '```' | |
| docker run --rm -v "./watch:/watch" ghcr.io/plowsof/monero-torrent-show:latest /watch/monero-gui-$VERSION_GUI.torrent | |
| echo '```' | |
| echo "### 🧲 CLI Magnet Link" | |
| echo '```' | |
| docker run --rm -v "./watch:/watch" ghcr.io/plowsof/monero-torrent-show:latest -m /watch/monero-$VERSION.torrent | |
| echo '```' | |
| echo "### 🧲 GUI Magnet Link" | |
| echo '```' | |
| docker run --rm -v "./watch:/watch" ghcr.io/plowsof/monero-torrent-show:latest -m /watch/monero-gui-$VERSION_GUI.torrent | |
| echo '```' | |
| } >> release-notes.md | |
| - name: Add release notes to step summary | |
| run: | | |
| cat release-notes.md >> $GITHUB_STEP_SUMMARY | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: github.ref_type == 'tag' | |
| with: | |
| body_path: release-notes.md | |
| files: watch/* | |
| - name: Add to RSS feed | |
| if: github.ref_type == 'tag' | |
| run: | | |
| git config --local user.email "torrent@users.noreply.github.com" | |
| git config --local user.name "updateRSS" | |
| git fetch origin "${GITHUB_REF_NAME}" | |
| git checkout "${GITHUB_REF_NAME}" | |
| git checkout -b update-rss-${VERSION} | |
| ./rss/add_to_rss.sh | |
| git add ./rss/torrent-rss.xml | |
| git commit -m "RSS: add $VERSION" | |
| git push origin HEAD:update-rss-${VERSION}-gui-${VERSION_GUI} --force |