-
Notifications
You must be signed in to change notification settings - Fork 740
87 lines (76 loc) · 2.39 KB
/
Copy pathrelease.yaml
File metadata and controls
87 lines (76 loc) · 2.39 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
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
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 }}"]'
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@v6
- 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
- name: build sdists
run: |
cabal sdist -o out all
shell: bash
- name: Release
uses: softprops/action-gh-release@v3
with:
draft: true
files: |
./out/*