Repository navigation
131 lines (116 loc) · 4.02 KB
/
Copy pathrelease.yaml
File metadata and controls
131 lines (116 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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/*