forked from julioverne/LowerInstall
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (61 loc) · 2.17 KB
/
Copy pathrelease.yml
File metadata and controls
70 lines (61 loc) · 2.17 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
name: Release
# Manual-only. The branch selector in the GitHub Actions UI picks the
# source ref; the workflow tags + releases from whatever was selected.
on:
workflow_dispatch:
inputs:
prerelease:
description: Mark the GitHub release as a pre-release
type: boolean
default: false
permissions:
contents: write # required to push the tag and create the release
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Read version from control
id: version
run: |
ver=$(awk '/^Version:/ {print $2}' control)
if [ -z "$ver" ]; then
echo "control file has no Version field" >&2
exit 1
fi
tag="v$ver"
echo "version=$ver" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Verify tag does not already exist
run: |
tag="${{ steps.version.outputs.tag }}"
if git rev-parse -q --verify "refs/tags/$tag" >/dev/null \
|| git ls-remote --exit-code --tags origin "$tag" >/dev/null 2>&1; then
echo "tag $tag already exists -- bump Version in control first" >&2
exit 1
fi
- name: Build container image
run: docker build -t lowerinstall-build -f Containerfile .
- name: Build .deb package
run: docker run --rm -v "$PWD:/build:Z" lowerinstall-build
- name: Locate built package
id: pkg
run: |
deb=$(ls packages/*.deb | head -n1)
if [ -z "$deb" ]; then
echo "no .deb produced under packages/" >&2
exit 1
fi
echo "path=$deb" >> "$GITHUB_OUTPUT"
- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.tag }}
target_commitish: ${{ github.sha }}
prerelease: ${{ inputs.prerelease }}
generate_release_notes: true
make_latest: ${{ inputs.prerelease && 'false' || 'true' }}
files: ${{ steps.pkg.outputs.path }}