Skip to content

merge queue: checking #12310 + #12497 together on master (3c15ba7) #7114

merge queue: checking #12310 + #12497 together on master (3c15ba7)

merge queue: checking #12310 + #12497 together on master (3c15ba7) #7114

Workflow file for this run

name: Build and release
on:
push:
tags:
- 'v*'
- 'cabal-install-*'
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- master
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
pull-requests: read
contents: write
env:
BUILD_LABEL: "run release build"
jobs:
check-pr-labels:
name: check PR labels
runs-on: ubuntu-latest
outputs:
run_release_workflow: ${{ steps.gen_output.outputs.run_release_workflow }}
steps:
- id: gen_output
run: |
if [ "${{ github.event.action }}" == 'labeled' ] ; then
if [ "${{ github.event.label.name }}" == "${{ env.BUILD_LABEL }}" ] ; then
echo run_release_workflow="yes" >> "$GITHUB_OUTPUT"
else
echo run_release_workflow="no" >> "$GITHUB_OUTPUT"
fi
elif [ "${{ github.event_name }}" = 'pull_request' ] ; then
run_it=$(if gh api --jq '.labels.[].name' /repos/${{ github.repository }}/pulls/${{ github.event.number }} | grep --quiet '^${{ env.BUILD_LABEL }}$' ; then printf "%s" "yes" ; else printf "%s" "no" ; fi)
echo "${run_it}"
echo run_release_workflow="${run_it}" >> "$GITHUB_OUTPUT"
else
echo run_release_workflow="yes" >> "$GITHUB_OUTPUT"
fi
shell: bash
env:
GH_TOKEN: ${{ github.token }}
release-workflow:
needs: ["check-pr-labels"]
if: ${{ needs.check-pr-labels.outputs.run_release_workflow == 'yes' }}
uses: ./.github/workflows/reusable-release.yml
with:
branches: '["${{ github.ref }}"]'
ghcup:
name: ghcup
needs: [ "release-workflow" ]
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Download artifacts
uses: actions/download-artifact@v8
with:
pattern: artifacts-*
merge-multiple: true
path: ./out
- name: Install requirements
run: |
sudo apt-get update && sudo apt-get install -y tar xz-utils rclone
shell: bash
- name: GHCup release channel
run: |
tar xf out/cabal-install-*-x86_64-linux-unknown.tar.xz
rm -f plan.json
RELEASE_VER=$(./cabal --numeric-version)
rm cabal
cd out/
bash ../.github/scripts/ghcup_yaml.bash \
"${RELEASE_VER}" \
"${{ vars.RCLONE_CONFIG_CABAL_ENDPOINT }}" \
"${{ github.event.pull_request.number }}" \
${{ vars.ENABLE_PRIVATE_RUNNERS }} \
> ghcup-${{ github.event.pull_request.number }}.yaml
rclone copy . cabal:cabal-install/${{ github.event.pull_request.number }}/
env:
RCLONE_CONFIG_CABAL_TYPE: b2
RCLONE_CONFIG_CABAL_KEY: ${{ secrets.RCLONE_CONFIG_CABAL_KEY }}
RCLONE_CONFIG_CABAL_ACCOUNT: ${{ secrets.RCLONE_CONFIG_CABAL_ACCOUNT }}
release:
name: release
needs: [ "release-workflow" ]
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Download artifacts
uses: actions/download-artifact@v8
with:
pattern: artifacts-*
merge-multiple: true
path: ./out
- name: Install requirements
run: |
sudo apt-get update && sudo apt-get install -y tar xz-utils
shell: bash
# NOTE ☞: Here is where we decide what to output in a GitHub release,
# so if we add a package which is meant to be released to Cabal, this
# has to be changed. See issue #12179.
- name: build sdists
run: |
cabal sdist --output-directory out/ Cabal-syntax Cabal-hooks Cabal cabal-install-solver hooks-exe cabal-install
shell: bash
- name: Release
uses: softprops/action-gh-release@v3
with:
draft: true
files: |
./out/*