2022-08-06 10:25:30 +00:00
|
|
|
pipeline:
|
|
|
|
test:
|
|
|
|
image: bats/bats
|
|
|
|
commands:
|
|
|
|
- /opt/bats/bin/bats test
|
2022-11-10 13:58:16 +00:00
|
|
|
|
2023-04-12 09:22:00 +00:00
|
|
|
release-prep:
|
|
|
|
# prepare changelog and version information for release candidate
|
2022-11-10 13:58:16 +00:00
|
|
|
when:
|
|
|
|
event: tag
|
|
|
|
tag: v*
|
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- sed -ne 's/bm_version=\(.*\)/\1/p' bemoji > NEWEST_VERSION.txt
|
|
|
|
- awk '/^## \[\d/{p++} p==2{print; exit} p>=1' CHANGELOG.md | head -n -1 | tail -n+3 > NEWEST_CHANGES.txt
|
|
|
|
|
2023-04-12 09:22:00 +00:00
|
|
|
versioncompare:
|
|
|
|
# ensure we correctly bumped versions
|
2022-11-10 13:58:16 +00:00
|
|
|
when:
|
|
|
|
event: tag
|
|
|
|
tag: v*
|
|
|
|
image: alpine
|
|
|
|
secrets: [ github_release_token, github_repo ]
|
|
|
|
commands:
|
|
|
|
- apk add jq curl
|
|
|
|
- "lastversion=$(curl -X GET -H \"Accept: application/vnd.github.v3+json\" -H \"Authorization: Bearer $GITHUB_RELEASE_TOKEN\" https://api.github.com/repos/$GITHUB_REPO/releases/latest | jq -r '.name')"
|
|
|
|
- "programversion=$(cat NEWEST_VERSION.txt)"
|
|
|
|
- changelogversion=$(sed -ne 's/^## \[\([0-9].*\)\].*$/\1/p' CHANGELOG.md | head -n1)
|
|
|
|
- echo "Last version - $lastversion"
|
|
|
|
- echo "New version - $programversion"
|
|
|
|
- echo "Changelog version - $changelogversion"
|
|
|
|
- "if [ \"$changelogversion\" != \"$programversion\" ]; then { echo \"VERSION MISMATCH: Changelog - $changelogversion, Program - $programversion\" && exit 1; }; fi"
|
|
|
|
- "if [ \"$lastversion\" = \"$programversion\" ]; then { echo \"RELEASE DUPLICATE: Last release already had version - $programversion\" && exit 1; }; fi"
|
|
|
|
|
|
|
|
build:
|
|
|
|
when:
|
|
|
|
event: tag
|
|
|
|
tag: v*
|
|
|
|
image: savant/md2man
|
|
|
|
commands:
|
|
|
|
- apk update && apk add zip
|
|
|
|
- BM_VERSION=$(cat NEWEST_VERSION.txt)
|
|
|
|
- mkdir -p build/doc dist
|
|
|
|
- cp bemoji build
|
|
|
|
- md2man -in README.md -out bemoji.1 && gzip bemoji.1
|
|
|
|
- cp LICENSE README.md bemoji.1.gz build/doc
|
2023-04-12 09:22:00 +00:00
|
|
|
- cd build || exit 1
|
|
|
|
- tar -czvf bemoji-$BM_VERSION.tar.gz *
|
|
|
|
- zip -r bemoji-$BM_VERSION.zip *
|
|
|
|
- mv bemoji-$BM_VERSION.tar.gz bemoji-$BM_VERSION.zip ../dist
|
2022-11-10 13:58:16 +00:00
|
|
|
|
|
|
|
release-gitea:
|
|
|
|
group: release
|
|
|
|
when:
|
|
|
|
event: tag
|
|
|
|
tag: v*
|
|
|
|
image: plugins/gitea-release
|
|
|
|
settings:
|
|
|
|
api_key:
|
|
|
|
from_secret: gitea_release_token
|
|
|
|
base_url: https://git.martyoeh.me
|
|
|
|
files: dist/*
|
|
|
|
title: NEWEST_VERSION.txt
|
|
|
|
note: NEWEST_CHANGES.txt
|
|
|
|
|
|
|
|
release-github:
|
|
|
|
when:
|
|
|
|
event: tag
|
|
|
|
tag: v*
|
|
|
|
image: alpine
|
|
|
|
secrets: [ github_release_token, github_repo ]
|
|
|
|
commands:
|
|
|
|
- apk add file jq curl
|
|
|
|
- BM_VERSION=$(cat NEWEST_VERSION.txt)
|
|
|
|
- BM_CHANGED=$(sed -e 's|#||g' -e 's|^.*$|\0 <br />|' NEWEST_CHANGES.txt) # display newlines workaround
|
2023-08-25 18:47:14 +00:00
|
|
|
- echo "{\"tag_name\":\"v${BM_VERSION}\",\"target_commitish\":\"main\",\"name\":\"v${BM_VERSION}\",\"body\":\"$BM_CHANGED\",\"draft\":false,\"prerelease\":false,\"generate_release_notes\":false}" > data.json
|
2022-11-10 13:58:16 +00:00
|
|
|
- "response=$(curl -X POST -H \"Accept:\\ application/vnd.github+json\" -H \"Authorization:\\ Bearer $GITHUB_RELEASE_TOKEN\" https://api.github.com/repos/$GITHUB_REPO/releases -d \"@data.json\")"
|
|
|
|
- "uploadurl=$(echo $response | jq -r '.upload_url' | cut -d'{' -f1)"
|
|
|
|
- "[ $uploadurl = null ] && { echo $response; exit 1; }"
|
|
|
|
- "curl -X POST -H \"Accept:\\ application/vnd.github.v3+json\" -H \"Authorization:\\ Bearer $GITHUB_RELEASE_TOKEN\" -H \"Content-Type:\\ $(file -b --mime-type dist/bemoji-$BM_VERSION.zip)\" -H \"Content-Length:\\ $(wc -c <dist/bemoji-$BM_VERSION.zip | xargs)\" -T dist/bemoji-$BM_VERSION.zip \"$uploadurl?name=bemoji-$BM_VERSION.zip\""
|
|
|
|
- "curl -X POST -H \"Accept:\\ application/vnd.github.v3+json\" -H \"Authorization:\\ Bearer $GITHUB_RELEASE_TOKEN\" -H \"Content-Type:\\ $(file -b --mime-type dist/bemoji-$BM_VERSION.tar.gz)\" -H \"Content-Length:\\ $(wc -c <dist/bemoji-$BM_VERSION.tar.gz | xargs)\" -T dist/bemoji-$BM_VERSION.tar.gz \"$uploadurl?name=bemoji-$BM_VERSION.tar.gz\""
|