add link to changes #99
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: dev-build | |
on: | |
push: | |
branches: [ wip/build-xpi ] | |
env: | |
XPI_NAME: tabmix-dev-build | |
jobs: | |
build-and-upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Set version in install.rdf | |
run: | | |
function next_version() { | |
local version=$(git tag --sort=-creatordate | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -n 1 | cut -c 2-) | |
if [[ $version =~ ^([0-9]+\.[0-9]+\.[0-9]+-pre\.)([0-9]+)$ ]]; then | |
local prefix=${BASH_REMATCH[1]} | |
local number=${BASH_REMATCH[2]} | |
let "number++" | |
echo "${prefix}${number}" | |
else | |
local IFS='.' | |
local -a parts=($version) | |
let "parts[-1]++" | |
echo "${parts[*]}" | |
fi | |
} | |
version=$(next_version) | |
date=$(date +'%Y%m%d.%H%M') | |
sed -i "s/1.0.0-unbundeled/$version-$date/" addon/install.rdf | |
echo "next version: $version-$date" | |
- name: Zip addon folder | |
run: | | |
cd addon | |
zip -rq /tmp/${{ env.XPI_NAME }}.xpi * | |
- name: Update dev-build tag | |
run: | | |
if [ $(git rev-parse dev-build) != $(git rev-parse HEAD) ]; then | |
git tag -d dev-build && git tag dev-build $(git rev-parse HEAD) | |
fi | |
- name: Upload release asset to GitHub | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
notes="This release includes an XPI file that is automatically generated after each push to the main branch." | |
if ! gh release view dev-build > /dev/null 2>&1; then | |
gh release create dev-build --title "Development Build" --notes "$notes" --draft --prerelease | |
fi | |
version_tag=$(git tag --sort=-creatordate | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -n 1) | |
if [ $(git rev-parse $version_tag) != $(git rev-parse HEAD) ]; then | |
changes_url="https://github.com/onemen/TabMixPlus/compare/$version_tag...HEAD" | |
notes="$notes\ | |
\ | |
Changes since [$version_tag]($changes_url)" | |
gh release edit dev-build --notes="$notes" | |
fi | |
gh release edit dev-build --draft=false | |
gh release upload dev-build /tmp/${{ env.XPI_NAME }}.xpi --clobber | |
- name: Upload to Bitbucket | |
run: | | |
curl --request POST \ | |
--url 'https://api.bitbucket.org/2.0/repositories/onemen/tabmixplus-for-firefox/downloads' \ | |
--header 'Authorization: Bearer ${{ secrets.BITBUCKET_ACCESS_TOKEN }}' \ | |
-F 'files=@/tmp/${{ env.XPI_NAME }}.xpi' |