CI: Use common SSH upload job

This commit is contained in:
Jonas Kvinge 2024-02-11 12:12:54 +01:00
parent 56f1a93c4e
commit 923d0f2b7a
1 changed files with 66 additions and 142 deletions

View File

@ -142,32 +142,24 @@ jobs:
CC: gcc-10 CC: gcc-10
CXX: g++-10 CXX: g++-10
run: rpmbuild -ba ../dist/unix/strawberry.spec run: rpmbuild -ba ../dist/unix/strawberry.spec
- name: Set opensuse subdir - name: Set subdir
run: echo "opensuse_subdir=$(echo ${{matrix.opensuse_version}} | sed 's/leap:/lp/g' | sed 's/\.//g')" > $GITHUB_ENV id: set-subdir
- name: Upload artifacts run: echo "subdir=$(echo ${{matrix.opensuse_version}} | sed 's/leap:/lp/g' | sed 's/\.//g')" > $GITHUB_OUTPUT
if: matrix.opensuse_version != 'tumbleweed' - name: Upload source
if: matrix.opensuse_version == 'tumbleweed' && matrix.qt_version == '6'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: opensuse-${{env.opensuse_subdir}}-qt${{matrix.qt_version}} name: source
path: | path: |
/usr/src/packages/SOURCES/*.xz /usr/src/packages/SOURCES/*.xz
- name: Upload rpm
if: matrix.opensuse_version != 'tumbleweed' && matrix.qt_version == '6'
uses: actions/upload-artifact@v4
with:
name: opensuse-${{steps.set-subdir.outputs.subdir}}
path: |
/usr/src/packages/SRPMS/*.rpm /usr/src/packages/SRPMS/*.rpm
/usr/src/packages/RPMS/x86_64/*.rpm /usr/src/packages/RPMS/x86_64/*.rpm
- name: SSH key setup
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci') && matrix.opensuse_version != 'tumbleweed' && matrix.qt_version == '6'
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{ secrets.SSH_KEY }}
- name: Create server path
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci') && matrix.opensuse_version != 'tumbleweed' && matrix.qt_version == '6'
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/source ${{secrets.BUILDS_PATH}}/opensuse/${{env.opensuse_subdir}}
- name: rsync source
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci') && matrix.opensuse_version == 'tumbleweed' && matrix.qt_version == '6'
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /usr/src/packages/SOURCES/*.xz ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/source/
- name: rsync rpms
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci') && matrix.opensuse_version != 'tumbleweed' && matrix.qt_version == '6'
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /usr/src/packages/SRPMS/*.rpm /usr/src/packages/RPMS/x86_64/*.rpm ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/opensuse/${{env.opensuse_subdir}}/
build-fedora: build-fedora:
@ -261,18 +253,6 @@ jobs:
path: | path: |
/github/home/rpmbuild/SRPMS/*.rpm /github/home/rpmbuild/SRPMS/*.rpm
/github/home/rpmbuild/RPMS/x86_64/*.rpm /github/home/rpmbuild/RPMS/x86_64/*.rpm
- name: SSH key setup
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{ secrets.SSH_KEY }}
- name: Create server path
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/fedora/${{matrix.fedora_version}}
- name: rsync
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /github/home/rpmbuild/SRPMS/*.rpm /github/home/rpmbuild/RPMS/x86_64/*.rpm ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/fedora/${{matrix.fedora_version}}/
build-openmandriva: build-openmandriva:
@ -365,24 +345,13 @@ jobs:
working-directory: build working-directory: build
run: rpmbuild -ba ../dist/unix/strawberry.spec run: rpmbuild -ba ../dist/unix/strawberry.spec
- name: Upload artifacts - name: Upload artifacts
if: matrix.opensuse_version != 'cooker'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: openmandriva-${{matrix.openmandriva_version}} name: openmandriva-${{matrix.openmandriva_version}}
path: | path: |
/github/home/rpmbuild/SRPMS/*.rpm /github/home/rpmbuild/SRPMS/*.rpm
/github/home/rpmbuild/RPMS/x86_64/*.rpm /github/home/rpmbuild/RPMS/x86_64/*.rpm
- name: SSH key setup
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && matrix.openmandriva_version != 'cooker' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{ secrets.SSH_KEY }}
- name: Create server path
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && matrix.openmandriva_version != 'cooker' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/openmandriva/${{matrix.openmandriva_version}}
- name: rsync
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && matrix.openmandriva_version != 'cooker' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /github/home/rpmbuild/SRPMS/*.rpm /github/home/rpmbuild/RPMS/x86_64/*.rpm ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/openmandriva/${{matrix.openmandriva_version}}/
build-mageia: build-mageia:
@ -473,18 +442,6 @@ jobs:
path: | path: |
/github/home/rpmbuild/SRPMS/*.rpm /github/home/rpmbuild/SRPMS/*.rpm
/github/home/rpmbuild/RPMS/x86_64/*.rpm /github/home/rpmbuild/RPMS/x86_64/*.rpm
- name: SSH key setup
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{ secrets.SSH_KEY }}
- name: Create server path
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/mageia/${{matrix.mageia_version}}
- name: rsync
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /github/home/rpmbuild/SRPMS/*.rpm /github/home/rpmbuild/RPMS/x86_64/*.rpm ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/mageia/${{matrix.mageia_version}}/
build-debian: build-debian:
@ -569,18 +526,6 @@ jobs:
with: with:
name: debian-${{matrix.debian_version}} name: debian-${{matrix.debian_version}}
path: "*.deb" path: "*.deb"
- name: SSH key setup
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{ secrets.SSH_KEY }}
- name: Create server path
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/debian/${{matrix.debian_version}}
- name: rsync
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var *.deb ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/debian/${{matrix.debian_version}}/
build-ubuntu: build-ubuntu:
@ -670,18 +615,6 @@ jobs:
path: | path: |
*.deb *.deb
*.ddeb *.ddeb
- name: SSH key setup
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{ secrets.SSH_KEY }}
- name: Create server path
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/ubuntu/${{matrix.ubuntu_version}}
- name: rsync
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var *.deb *.ddeb ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/ubuntu/${{matrix.ubuntu_version}}/
upload-ubuntu-ppa: upload-ubuntu-ppa:
@ -889,28 +822,29 @@ jobs:
run: make dmg run: make dmg
- name: SSH key setup - name: SSH key setup
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos') if: github.repository == 'strawberrymusicplayer/strawberry' && (github.event_name == 'release' || (github.event_name == 'push' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos')))
uses: shimataro/ssh-key-action@v2 uses: shimataro/ssh-key-action@v2
with: with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}} known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{ secrets.SSH_KEY }} key: ${{ secrets.SSH_KEY }}
- name: Set Upload path - name: Set Upload path
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos') id: set-upload-path
if: github.repository == 'strawberrymusicplayer/strawberry' && (github.event_name == 'release' || (github.event_name == 'push' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos')))
run: | run: |
if [ "${{github.event_name}}" = "release" ]; then if [ "${{github.event_name}}" = "release" ]; then
echo "upload_path=${{secrets.DOWNLOADS_PATH}}/stable_releases/macos" >> $GITHUB_ENV echo "upload_path=${{secrets.DOWNLOADS_PATH}}/stable_releases/macos" >> $GITHUB_OUTPUT
else else
echo "upload_path=${{secrets.DOWNLOADS_PATH}}/development_releases/macos" >> $GITHUB_ENV echo "upload_path=${{secrets.DOWNLOADS_PATH}}/development_releases/macos" >> $GITHUB_OUTPUT
fi fi
- name: Create server path - name: Create server path
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos') if: steps.set-upload-path.outputs.upload_path != ''
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{env.upload_path}} run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{steps.set-upload-path.outputs.upload_path}}
- name: rsync - name: rsync
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos') if: steps.set-upload-path.outputs.upload_path != ''
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var build/*.dmg ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{env.upload_path}}/ run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var build/*.dmg ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{steps.set-upload-path.outputs.upload_path}}/
build-macos-private: build-macos-private:
@ -1008,18 +942,19 @@ jobs:
run: make dmg run: make dmg
- name: Set Upload path - name: Set Upload path
id: set-upload-path
run: | run: |
if [ "${{github.event_name}}" = "release" ]; then if [ "${{github.event_name}}" = "release" ]; then
echo "upload_path=${{secrets.DOWNLOADS_PATH}}/stable_releases/macos" >> $GITHUB_ENV echo "upload_path=${{secrets.DOWNLOADS_PATH}}/stable_releases/macos" >> $GITHUB_OUTPUT
else else
echo "upload_path=${{secrets.DOWNLOADS_PATH}}/development_releases/macos" >> $GITHUB_ENV echo "upload_path=${{secrets.DOWNLOADS_PATH}}/development_releases/macos" >> $GITHUB_OUTPUT
fi fi
- name: Create server path - name: Create server path
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{env.upload_path}} run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{steps.set-upload-path.outputs.upload_path}}
- name: rsync - name: rsync
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var build/*.dmg ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{env.upload_path}}/ run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var build/*.dmg ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{steps.set-upload-path.outputs.upload_path}}/
build-windows-mingw: build-windows-mingw:
@ -1192,21 +1127,6 @@ jobs:
name: windows-mingw-${{matrix.arch}}-${{matrix.buildtype}} name: windows-mingw-${{matrix.arch}}-${{matrix.buildtype}}
path: build/StrawberrySetup*.exe path: build/StrawberrySetup*.exe
- name: SSH key setup
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{ secrets.SSH_KEY }}
- name: Create server path
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/windows/mingw
- name: rsync
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var build/StrawberrySetup*.exe ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/windows/mingw/
build-windows-msvc: build-windows-msvc:
name: Build Windows MSVC name: Build Windows MSVC
@ -1558,35 +1478,57 @@ jobs:
path: build/StrawberrySetup*.exe path: build/StrawberrySetup*.exe
rsync-windows-msvc-builds: upload:
name: Rsync Windows MSVC builds name: Upload
if: github.event_name == 'push' && github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci') if: github.repository == 'strawberrymusicplayer/strawberry' && (github.event_name == 'release' || (github.event_name == 'push' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')))
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- build-opensuse
- build-fedora
- build-debian
- build-ubuntu
- build-windows-mingw
- build-windows-msvc - build-windows-msvc
steps: steps:
- name: Install packages
env:
DEBIAN_FRONTEND: noninteractive
run: sudo apt install -y git rsync
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: builds path: artifacts
pattern: windows-msvc-*
- name: View files
run: find builds
- name: SSH key setup - name: SSH key setup
uses: shimataro/ssh-key-action@v2 uses: shimataro/ssh-key-action@v2
with: with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}} known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{secrets.SSH_KEY}} key: ${{secrets.SSH_KEY}}
- name: Create server path - name: Upload
shell: bash run: |
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/windows/msvc for i in $(find artifacts -type f); do
- name: rsync if [ "${{github.event_name}}" = "release" ]; then
shell: bash upload_path="${{secrets.RELEASES_PATH}}/"
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var builds/*/StrawberrySetup-*-msvc-*.exe ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/windows/msvc/ else
distro=$(echo "$i" | cut -d '/' -f 2)
if [ "$(echo debian-bookworm | grep '-' || true)" = "" ]; then
upload_path="${{secrets.BUILDS_PATH}}/${distro}/"
else
distro_name=$(echo "${distro}" | cut -d '-' -f 1)
distro_version=$(echo "${distro}" | cut -d '-' -f 2)
upload_path="${{secrets.BUILDS_PATH}}/${distro_name}/${distro_version}/"
fi
fi
ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${upload_path}
rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var $i ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${upload_path}/
done
upload-release: attach:
name: Upload release name: Attach to release
if: github.event_name == 'release' if: github.event_name == 'release'
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
@ -1597,40 +1539,28 @@ jobs:
- build-windows-mingw - build-windows-mingw
- build-windows-msvc - build-windows-msvc
steps: steps:
- name: Install packages - name: Install packages
env: env:
DEBIAN_FRONTEND: noninteractive DEBIAN_FRONTEND: noninteractive
run: sudo apt install -y git rsync hub run: sudo apt install -y git hub
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Show release assets - name: Show release assets
env: env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: hub release show -f "%as" ${{github.event.release.tag_name}} run: hub release show -f "%as" ${{github.event.release.tag_name}}
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: artifacts path: artifacts
- name: SSH key setup
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
key: ${{secrets.SSH_KEY}}
- name: Add artifacts to release - name: Add artifacts to release
env: env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: | run: |
echo "Release version: ${{github.event.release.tag_name}}" echo "Release version: ${{github.event.release.tag_name}}"
filenames=() filenames=()
files=()
a_files=() a_files=()
for i in $(find artifacts -type f); do for i in $(find artifacts -type f); do
filename=$(basename $i) filename=$(basename $i)
@ -1642,19 +1572,13 @@ jobs:
existing_asset=$(hub release show -f "%as" ${{github.event.release.tag_name}} | tr -d '[:blank:]' | grep ".*/${filename}\$" 2>/dev/null || true) existing_asset=$(hub release show -f "%as" ${{github.event.release.tag_name}} | tr -d '[:blank:]' | grep ".*/${filename}\$" 2>/dev/null || true)
if [ "${existing_asset}" = "" ]; then if [ "${existing_asset}" = "" ]; then
echo "Adding file: ${filename}" echo "Adding file: ${filename}"
files+=("$i")
a_files+=("-a" "${i}") a_files+=("-a" "${i}")
else else
echo "Release already has file: ${filename}" echo "Release already has file: ${filename}"
fi fi
done done
files_list="${files[@]}"
a_files_list="${a_files[@]}" a_files_list="${a_files[@]}"
if ! [ "${files_list}" = "" ]; then
echo "Uploading files: ${files_list}"
rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var ${files_list} ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.RELEASES_PATH}}/
fi
if ! [ "${a_files_list}" = "" ]; then if ! [ "${a_files_list}" = "" ]; then
echo "Adding files to GitHub release: ${files_list}" echo "Adding files to GitHub release"
hub release edit -m "Strawberry ${{github.event.release.tag_name}}" ${a_files_list} "${{github.event.release.tag_name}}" hub release edit -m "Strawberry ${{github.event.release.tag_name}}" ${a_files_list} "${{github.event.release.tag_name}}"
fi fi