raz / .github / workflows / ci.yml

49 lines · 1.6 KiB · raw · history · last change 0442dd12

1# Checks every push to main. A pushed tag vX.Y.Z is checked too and
2# becomes a GitHub release, with a tarball of raz, the lib/ it reads
3# beside itself, and the manual pages. Run by hand with a tag, it releases an older tag.
4# Actions are pinned by commit; only the release job may write.
5name: ci
6on:
7 push:
8 branches: [main]
9 tags: ['v*']
10 workflow_dispatch:
11 inputs:
12 tag:
13 description: the tag to release
14 required: true
15permissions:
16 contents: read
17env:
18 TAG: ${{ inputs.tag || (github.ref_type == 'tag' && github.ref_name) || '' }}
19jobs:
20 check:
21 runs-on: ubuntu-24.04
22 steps:
23 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
24 with:
25 ref: ${{ inputs.tag || github.ref }}
26 fetch-depth: 0 # git describe needs the tags
27 persist-credentials: false
28 # musl and musl-tools: test/libc over musl, and cabi with musl-gcc
29 - run: sudo apt-get update && sudo apt-get install -y musl musl-tools
30 - run: make check
31 - run: make alpine
32 release:
33 needs: check
34 if: inputs.tag || github.ref_type == 'tag'
35 runs-on: ubuntu-24.04
36 permissions:
37 contents: write
38 steps:
39 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
40 with:
41 ref: ${{ inputs.tag || github.ref }}
42 fetch-depth: 0
43 persist-credentials: false
44 - env:
45 GH_TOKEN: ${{ github.token }}
46 run: |
47 make raz dist
48 gh release create "$TAG" build/raz-${TAG#v}-linux-x86_64.tar.gz --verify-tag \
49 --title "raz ${TAG#v}" --notes "$(./raz --version)"