From 4127f6ec2dd6888fe12d541c3d4a94fdc9d4a55f Mon Sep 17 00:00:00 2001 From: Matthew Fluet Date: Mon, 30 Dec 2024 06:08:28 -0500 Subject: [PATCH] Create a GitHub action to automate creation of SourceForge release --- .github/workflows/release.yml | 7 ++++ .github/workflows/sourceforge-release.yml | 44 +++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/sourceforge-release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c9c99cb4..62b07c777 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,3 +30,10 @@ jobs: with: mlton-version: ${{ needs.mlton-version.outputs.mlton-version }} secrets: inherit + + sourceforge-release: + needs: [mlton-version, source-release, binary-release] + uses: ./.github/workflows/sourceforge-release.yml + with: + mlton-version: ${{ needs.mlton-version.outputs.mlton-version }} + secrets: inherit diff --git a/.github/workflows/sourceforge-release.yml b/.github/workflows/sourceforge-release.yml new file mode 100644 index 000000000..a04d5092d --- /dev/null +++ b/.github/workflows/sourceforge-release.yml @@ -0,0 +1,44 @@ +name: SourceForge Release + +on + workflow_dispatch: + inputs: + mlton-version: + required: true + type: string + workflow_call: + inputs: + mlton-version: + required: true + type: string + +jobs: + sourceforge-release: + runs-on: ubuntu-24.04 + env: + SSH_KEY_RSA: ${{ secrets.MLTON_WEBMASTER_SSH_KEY_RSA }} + SSH_KEY_ED25519: ${{ secrets.MLTON_WEBMASTER_SSH_KEY_ED25519 }} + SSH_CONFIG: ${{ secrets.MLTON_WEBMASTER_SSH_CONFIG }} + SSH_KNOWN_HOSTS: ${{ secrets.MLTON_WEBMASTER_SSH_KNOWN_HOSTS }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: .github + ref: ${{ inputs.checkout-ref || 'master' }} + - name: Download release assets + run: gh release download on-${{ inputs.mlton-version }}-release --dir assets --pattern '*' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create SourceForge release directory + run: sftp -b <(echo "-mkdir ${{ inputs.mlton-version }}") mlton-webmaster,mlton@frs.sourceforge.net:/home/frs/project/mlton/mlton + - name: Upload release assets to SourceForge + run: rsync -azP --delete -e ssh assets/ mlton-webmaster,mlton@frs.sourceforge.net:/home/frs/project/mlton/mlton/${{ inputs.mlton-version }}/ + - name: Upload release guide to SourceForge + run: | + tar xzf assets/mlton-${{ inputs.mlton-version }}.src.tgz + cd mlton-${{ inputs.mlton-version }}/doc/guide + mv localhost ${{ inputs.mlton-version }} + tar czf guide-${{ inputs.mlton-version }}.tgz ${{ inputs.mlton-version }} + rsync -azP --delete -e ssh ${{ inputs.mlton-version }} mlton-webmaster,mlton@web.sourceforge.net:/home/project-web/mlton/htdocs/guide/ +rsync -azP --delete -e ssh guide-${{ inputs.mlton-version }} mlton-webmaster,mlton@web.sourceforge.net:/home/project-web/mlton/htdocs/guide/