From 9f9dd0f130a00ed626ea8f2d537e6c61c17775ab Mon Sep 17 00:00:00 2001 From: Matthew Fluet Date: Fri, 20 Dec 2024 16:56:30 -0500 Subject: [PATCH] Experiment with a release workflow --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..d1e134ba9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + release: + types: [published] + +jobs: + mlton-version: + runs-on: ubuntu-latest + 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: + runs-on: ubuntu-latest + needs: mlton-version + env: + MLTON_VERSION: ${{ needs.mlton-version.outputs.MLTON_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + 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 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}