diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..8b451e685 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + mlton-version: + runs-on: ubuntu-24.04 + outputs: + mlton-version: ${{ steps.mlton-version.outputs.mlton-version }} + steps: + - name: mlton-version + id: mlton-version + run: | + MLTON_VERSION=$( echo '${{ github.ref_name }}' | sed -En 's;on-([0-9]{8})-release;\1;p') + if [ -n "${MLTON_VERSION}" ]; then echo "mlton-version=${MLTON_VERSION}" >> "$GITHUB_OUTPUT"; else echo "Unable to determine MLTON_VERSION"; exit 1; fi + + source-release: + needs: mlton-version + uses: ./.github/workflows/source-release + with: + mlton-version: ${{ needs.mlton-version.outputs.mlton-version }} + secrets: inherit diff --git a/.github/workflows/source-release.yml b/.github/workflows/source-release.yml new file mode 100644 index 000000000..430e05544 --- /dev/null +++ b/.github/workflows/source-release.yml @@ -0,0 +1,33 @@ +name: Source Release + +on: + workflow_dispatch: + inputs: + mlton-version: + required: true + type: string + workflow_call: + inputs: + mlton-version: + required: true + type: string + +jobs: + source-release: + runs-on: ubuntu-latest + env: + MLTON_VERSION: ${{ inputs.mlton-version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: on-${{ inputs.mlton-version }}-release + fetch-depth: 0 + - name: Install guide dependencies + uses: ./.github/actions/install-guide-dependencies + - name: Make source release + run: make MLTON_VERSION=${MLTON_VERSION} source-release + - name: Upload source release + run: gh release upload on-${MLTON_VERSION}-release mlton-${MLTON_VERSION}.src.tgz --clobber + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}