uBO Lite release #204
This file contains hidden or 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: uBO Lite release | |
| on: workflow_dispatch | |
| permissions: | |
| contents: read | |
| # I used the following project as template to get started: | |
| # https://github.com/dessant/search-by-image/blob/master/.github/workflows/ci.yml | |
| jobs: | |
| build: | |
| permissions: | |
| contents: write # for creating release | |
| name: Build packages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone repository | |
| uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| submodules: recursive | |
| - name: Locate uBO repo | |
| run: | | |
| UBOL_REPO_DIR=$(pwd) | |
| UBLOCK_REPO_DIR="$UBOL_REPO_DIR/uBlock" | |
| echo "UBLOCK_REPO_DIR=$UBLOCK_REPO_DIR" >> $GITHUB_ENV | |
| # Version, time-based | |
| - name: Create unique time-based version | |
| run: | | |
| TAGNAME=$(date -u "+%Y").$(date -u "+%-m*100+%-d" | bc).$(date -u "+%H*100+%M" | bc) | |
| echo "TAGNAME=$TAGNAME" >> $GITHUB_ENV | |
| echo "Version: $TAGNAME" | |
| # Chromium | |
| - name: Build Chromium uBOLite | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| UBOL_REPO_DIR=$(pwd) | |
| cd $UBLOCK_REPO_DIR | |
| tools/make-mv3.sh chromium ${{ env.TAGNAME }} before=$UBOL_REPO_DIR | |
| echo "CHROMIUM_PACKAGE=uBOLite_${{ env.TAGNAME }}.chromium.zip" >> $GITHUB_ENV | |
| cd - > /dev/null | |
| rm -rf chromium | |
| mv "$UBLOCK_REPO_DIR/dist/build/uBOLite.chromium" chromium | |
| # Edge | |
| - name: Build Edge uBOLite | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| UBOL_REPO_DIR=$(pwd) | |
| cd $UBLOCK_REPO_DIR | |
| tools/make-mv3.sh edge ${{ env.TAGNAME }} | |
| echo "EDGE_PACKAGE=uBOLite_${{ env.TAGNAME }}.edge.zip" >> $GITHUB_ENV | |
| cd - > /dev/null | |
| # Firefox | |
| - name: Build Firefox uBOLite | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| UBOL_REPO_DIR=$(pwd) | |
| cd $UBLOCK_REPO_DIR | |
| tools/make-mv3.sh firefox ${{ env.TAGNAME }} | |
| echo "FIREFOX_PACKAGE=uBOLite_${{ env.TAGNAME }}.firefox.xpi" >> $GITHUB_ENV | |
| cd - > /dev/null | |
| # Safari | |
| - name: Build Safari uBOLite | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| UBOL_REPO_DIR=$(pwd) | |
| cd $UBLOCK_REPO_DIR | |
| tools/make-mv3.sh safari ${{ env.TAGNAME }} | |
| echo "SAFARI_PACKAGE=uBOLite_${{ env.TAGNAME }}.safari.zip" >> $GITHUB_ENV | |
| cd - > /dev/null | |
| - name: Commit uBOLite MV3 package files | |
| # https://github.com/marketplace/actions/github-action-for-committing-changes-to-a-repository | |
| uses: devops-infra/action-commit-push@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| commit_message: "[workflow] Update uBOLite MV3 package files for ${{ env.TAGNAME }}" | |
| - name: Assemble release text | |
| run: | | |
| sed -e 's/%tag%/${{ env.TAGNAME }}/g' .github/workflows/RELEASE_BODY.md > release_body0.txt | |
| grep -m1 -B10000 -- "----------" CHANGELOG.md | head -n -2 > release_notes.txt | |
| sed -e '/%changelog%/{r release_notes.txt' -e 'd}' release_body0.txt > release_body.txt | |
| - name: Create GitHub release | |
| id: create_release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create ${{ env.TAGNAME }} \ | |
| --title "${{ env.TAGNAME }}" \ | |
| --prerelease \ | |
| --notes-file release_body.txt | |
| gh release upload ${{ env.TAGNAME }} \ | |
| ${{ env.UBLOCK_REPO_DIR }}/dist/build/${{ env.CHROMIUM_PACKAGE }} \ | |
| ${{ env.UBLOCK_REPO_DIR }}/dist/build/${{ env.EDGE_PACKAGE }} \ | |
| ${{ env.UBLOCK_REPO_DIR }}/dist/build/${{ env.FIREFOX_PACKAGE }} \ | |
| ${{ env.UBLOCK_REPO_DIR }}/dist/build/${{ env.SAFARI_PACKAGE }} |