From 1ffc57fd9d61b111217083c012f63bbe090499d6 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 3 Dec 2024 10:14:24 +0000 Subject: Working towards an auto-publishing script --- .github/workflows/onefiledist.yml | 76 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/.github/workflows/onefiledist.yml b/.github/workflows/onefiledist.yml index 542221d..4c8c6ac 100644 --- a/.github/workflows/onefiledist.yml +++ b/.github/workflows/onefiledist.yml @@ -49,6 +49,9 @@ jobs: with: name: Tclsh ${{ env.TCL_PATCHLEVEL }} Linux single-file build (snapshot) path: 1dist/*.tar + id: upload + outputs: + url: ${{ steps.upload.outputs.artifact-url }} macos: name: macOS runs-on: macos-13 @@ -116,6 +119,9 @@ jobs: with: name: Tclsh ${{ env.TCL_PATCHLEVEL }} macOS single-file build (snapshot) path: 1dist/*.dmg + id: upload + outputs: + url: ${{ steps.upload.outputs.artifact-url }} win: name: Windows runs-on: windows-2019 @@ -165,3 +171,73 @@ jobs: with: name: Tclsh ${{ env.TCL_PATCHLEVEL }} Windows single-file build (snapshot) path: '1dist/*_snapshot.exe' + id: upload + outputs: + url: ${{ steps.upload.outputs.artifact-url }} + combine: + needs: + - linux + - macos + - win + name: Combine Artifacts (prototype) + runs-on: ubuntu-latest + defaults: + run: + shell: bash + timeout-minutes: 10 + env: + # See also + # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables + REMOTE_PATH: ${{ vars.PUBLISH_DROP_PATH }}/data-${{ github.sha }} + steps: + - name: Make directory + run: | + mkdir data + - name: Get Linux build + uses: actions/download-artifact@v4 + with: + path: data + # Can't download by artifact ID; stupid missing feature! + merge-multiple: true + - name: Check data downloaded + run: | + ls -AlR + working-directory: data + - name: Transfer built files + # https://github.com/marketplace/actions/rsync-deployments-action + uses: burnett01/rsync-deployments@7.0.1 + id: rsync + if: false # Disabled... for now + with: + # I don't know what the right switches are here, BTW + switches: -avzr + path: data/ + remote_path: ${{ env.REMOTE_PATH }} + remote_host: ${{ vars.PUBLISH_HOST }} + remote_user: ${{ vars.PUBLISH_USER }} + remote_key: ${{ secrets.DEPLOY_HOST_KEY }} + # MUST be a literal passwordless key + - name: Publish files + # https://github.com/marketplace/actions/ssh-remote-commands + uses: appleboy/ssh-action@v1.2.0 + id: ssh + if: steps.rsync.outcome == 'success' + with: + host: ${{ vars.PUBLISH_HOST }} + username: ${{ vars.PUBLISH_USER }} + key: ${{ secrets.DEPLOY_HOST_KEY }} + script: | + ${{ vars.PUBLISHER_SCRIPT }} ${{ env.REMOTE_PATH }} ${{ github.ref_type }} ${{ github.ref_name }} + - name: Report what would be done + if: steps.rsync.outcome == 'skipped' + env: + SWITCHES: -av + LOCAL_PATH: data/ + REMOTE_HOST: ${{ vars.PUBLISH_HOST }} + REMOTE_USER: ${{ vars.PUBLISH_USER }} + REMOTE_SCRIPT: | + ${{ vars.PUBLISHER_SCRIPT }} ${{ env.REMOTE_PATH }} ${{ github.ref_type }} ${{ github.ref_name }} + run: | + echo "would run: rsync $SWITCHES $LOCAL_PATH $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH" + echo "would run: ssh $REMOTE_USER@$REMOTE_HOST $REMOTE_SCRIPT" + # Consider https://github.com/marketplace/actions/slack-notify maybe? -- cgit v0.12