| 1 |
name: Release tarball |
| 2 |
|
| 3 |
on: |
| 4 |
release: |
| 5 |
types: [created] |
| 6 |
|
| 7 |
permissions: |
| 8 |
contents: write |
| 9 |
statuses: read |
| 10 |
|
| 11 |
jobs: |
| 12 |
build: |
| 13 |
runs-on: ubuntu-latest |
| 14 |
|
| 15 |
steps: |
| 16 |
- uses: actions/checkout@v6 |
| 17 |
with: |
| 18 |
ref: ${{ github.event.release.tag_name }} |
| 19 |
|
| 20 |
- name: Check autotools status |
| 21 |
id: check_status |
| 22 |
uses: actions/github-script@v9 |
| 23 |
with: |
| 24 |
script: | |
| 25 |
const owner = context.repo.owner; |
| 26 |
const repo = context.repo.repo; |
| 27 |
const tagName = context.payload.release.tag_name; |
| 28 |
const tagRef = await github.rest.git.getRef({ |
| 29 |
owner, |
| 30 |
repo, |
| 31 |
ref: `tags/${tagName}` |
| 32 |
}); |
| 33 |
|
| 34 |
let releaseCommit = tagRef.data.object.sha; |
| 35 |
if (tagRef.data.object.type === 'tag') { |
| 36 |
const tag = await github.rest.git.getTag({ |
| 37 |
owner, |
| 38 |
repo, |
| 39 |
tag_sha: releaseCommit |
| 40 |
}); |
| 41 |
releaseCommit = tag.data.object.sha; |
| 42 |
} |
| 43 |
|
| 44 |
const status = await github.rest.repos.getCombinedStatusForRef({ |
| 45 |
owner, |
| 46 |
repo, |
| 47 |
ref: releaseCommit |
| 48 |
}); |
| 49 |
const autotoolsStatus = status.data.statuses.find(s => s.context === 'autotools'); |
| 50 |
if (!autotoolsStatus || autotoolsStatus.state !== 'success') { |
| 51 |
core.setFailed('Autotools build did not complete successfully'); |
| 52 |
} |
| 53 |
|
| 54 |
- name: Install dependencies on Ubuntu |
| 55 |
run: | |
| 56 |
sudo apt-get update |
| 57 |
sudo apt-get install -y autoconf automake autopoint doxygen g++ gettext git libtool make texinfo texlive texlive-font-utils zsh |
| 58 |
|
| 59 |
- name: Check release metadata |
| 60 |
run: scripts/release/check.zsh --release ${{ github.event.release.tag_name }} |
| 61 |
|
| 62 |
- name: Run autogen |
| 63 |
run: ./autogen.sh |
| 64 |
|
| 65 |
- name: Configure |
| 66 |
run: | |
| 67 |
export CC=gcc CXX=g++ |
| 68 |
./configure |
| 69 |
|
| 70 |
- name: Build and Test |
| 71 |
run: make -j distcheck |
| 72 |
|
| 73 |
- name: Check distribution tarball |
| 74 |
run: scripts/release/check.zsh --release --require-dist ${{ github.event.release.tag_name }} |
| 75 |
|
| 76 |
- name: Upload Release Asset |
| 77 |
env: |
| 78 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 79 |
TAG_NAME: ${{ github.event.release.tag_name }} |
| 80 |
run: | |
| 81 |
gh release upload "${TAG_NAME}" \ |
| 82 |
"./fswatch-${TAG_NAME}.tar.gz#fswatch-${TAG_NAME}.tar.gz" \ |
| 83 |
--repo "${GITHUB_REPOSITORY}" \ |
| 84 |
--clobber |
| 85 |
|
| 86 |
- name: Build static Linux x86_64 convenience binary |
| 87 |
env: |
| 88 |
TAG_NAME: ${{ github.event.release.tag_name }} |
| 89 |
run: | |
| 90 |
docker run --rm \ |
| 91 |
-e JOBS="$(nproc)" \ |
| 92 |
-e TAG_NAME="${TAG_NAME}" \ |
| 93 |
-v "${PWD}:/work" \ |
| 94 |
-w /work \ |
| 95 |
alpine:latest \ |
| 96 |
sh -euxc ' |
| 97 |
apk add --no-cache autoconf automake binutils build-base file gettext-dev git libtool make tar texinfo zsh |
| 98 |
git config --global --add safe.directory /work |
| 99 |
zsh ./scripts/release/build-static-linux-x86_64.zsh "${TAG_NAME}" |
| 100 |
' |
| 101 |
|
| 102 |
- name: Upload static Linux x86_64 convenience binary |
| 103 |
env: |
| 104 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 105 |
TAG_NAME: ${{ github.event.release.tag_name }} |
| 106 |
run: | |
| 107 |
gh release upload "${TAG_NAME}" \ |
| 108 |
"./fswatch-${TAG_NAME}-linux-x86_64-static.tar.gz#fswatch-${TAG_NAME}-linux-x86_64-static.tar.gz" \ |
| 109 |
--repo "${GITHUB_REPOSITORY}" \ |
| 110 |
--clobber |
| 111 |
|
| 112 |
- name: Build PDF documentation |
| 113 |
run: make -j pdf |
| 114 |
|
| 115 |
- name: Upload Release PDF documentation |
| 116 |
env: |
| 117 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 118 |
TAG_NAME: ${{ github.event.release.tag_name }} |
| 119 |
run: | |
| 120 |
cp ./fswatch/doc/fswatch.pdf "./fswatch-${TAG_NAME}.pdf" |
| 121 |
gh release upload "${TAG_NAME}" \ |
| 122 |
"./fswatch-${TAG_NAME}.pdf" \ |
| 123 |
--repo "${GITHUB_REPOSITORY}" \ |
| 124 |
--clobber |
| 125 |
|
| 126 |
- name: Build libfswatch Doxygen HTML documentation |
| 127 |
run: make -C libfswatch/doc/doxygen doc-html-doxygen |
| 128 |
|
| 129 |
- name: Upload Release libfswatch Doxygen HTML documentation |
| 130 |
env: |
| 131 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 132 |
TAG_NAME: ${{ github.event.release.tag_name }} |
| 133 |
run: | |
| 134 |
test -f ./libfswatch/doc/doxygen/html/index.html |
| 135 |
DOCS_STAGING="${RUNNER_TEMP}/libfswatch-doxygen-release" |
| 136 |
rm -rf "${DOCS_STAGING}" |
| 137 |
mkdir -p "${DOCS_STAGING}/doc/libfswatch/${TAG_NAME}" |
| 138 |
cp -R ./libfswatch/doc/doxygen/html/. "${DOCS_STAGING}/doc/libfswatch/${TAG_NAME}/" |
| 139 |
tar -C "${DOCS_STAGING}" -czf "./fswatch-${TAG_NAME}-libfswatch-doxygen-html.tar.gz" "doc/libfswatch/${TAG_NAME}" |
| 140 |
gh release upload "${TAG_NAME}" \ |
| 141 |
"./fswatch-${TAG_NAME}-libfswatch-doxygen-html.tar.gz" \ |
| 142 |
--repo "${GITHUB_REPOSITORY}" \ |
| 143 |
--clobber |