Skip to content

Update manifest.json #8

Update manifest.json

Update manifest.json #8

name: Compile And Release
on:
push:
paths:
- 'manifest.json'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install jq
npm install crx
- name: Extract version from manifest.json
run: echo "VERSION=$(jq -r .version manifest.json)" >> $GITHUB_ENV
- name: Remove previous CRX
run: |
rm -f .github/releases/ThottaThukiduven.crx
- name: Package extension to CRX
run: |
echo "$PRIVATE_KEY_PEM" > private_key.pem
npx crx pack . -o .github/releases/ThottaThukiduven.crx -p private_key.pem
env:
PRIVATE_KEY_PEM: ${{ secrets.PRIVATE_KEY_PEM }}
- name: Extract extension ID from CRX
run: |
EXTENSION_ID=$(npx crx id .github/releases/ThottaThukiduven.crx)
echo "EXTENSION_ID=$EXTENSION_ID" >> $GITHUB_ENV
- name: Generate updates.xml
run: |
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<gupdate xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\">
<app appid=\"$EXTENSION_ID\">
<updatecheck codebase=\"https://github.com/sr2echa/ThottaThukiduven/raw/main/.github/releases/ThottaThukiduven.crx\" version=\"$VERSION\" />
</app>
</gupdate>" > .github/releases/updates.xml
- name: Commit and push CRX and updates.xml to repository
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .github/releases/ThottaThukiduven.crx .github/releases/updates.xml
git commit -m "Add compiled extension and updates.xml"
git push
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: Description of the release.
draft: false
prerelease: false
- name: Upload CRX to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./.github/releases/ThottaThukiduven.crx
asset_name: ThottaThukiduven.crx
asset_content_type: application/x-chrome-extension