Skip to content
name: Build NextNTP Extension
on:
push:
branches:
- main
jobs:
build-extension:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Set version from package.json to manifest.json
run: |
manifest_path="src/manifest.json"
package_json_path="package.json"
version=$(jq -r '.version' "$package_json_path")
echo "Extracted version: $version"
jq --arg v "$version" '.version = $v' "$manifest_path" > tmp.$$.json && mv tmp.$$.json "$manifest_path"
echo "VERSION=$version" >> $GITHUB_ENV
- name: Build NextNTP as extension
run: npm run ext
- name: Generate PEM file
run: echo "${{ secrets.NEXTNTP_PEM }}" > nextntp.pem
- name: Install CRX CLI
run: npm install -g crx
- name: Build the CRX version of NextNTP
run: crx pack ./dist-ext -o ./build/nextntp_${{ env.VERSION }}.crx -p nextntp.pem
- name: Update manifest with public key
run: >
sed -i "2 i \"key\": \"$(2>/dev/null openssl rsa -in nextntp.pem -pubout -outform DER | openssl base64 -A)\"," dist-ext/manifest.json
- name: Build the ZIP version of NextNTP
run: zip -r nextntp_${{ env.VERSION }}.zip ./dist-ext
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: extension-files
path: |
./nextntp_${{ env.VERSION }}.crx
./nextntp_${{ env.VERSION }}.zip