Skip to content

CI/CD for Chrome Extension #21

CI/CD for Chrome Extension

CI/CD for Chrome Extension #21

Workflow file for this run

name: CI/CD for Chrome Extension
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cleanup
run: |
rm output -rf
- name: Zip the extension
run: |
mkdir output
VERSION=$(jq -r '.version' ./app/manifest.json)
zip -r ./output/ShaderToy-Chrome-Plugin-$VERSION.zip ./app
echo $VERSION >> ./output/version.txt
- name: Upload output as artifact
uses: actions/upload-artifact@v4
with:
name: output
path: output/
publish:
runs-on: self-hosted
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download output artifact
uses: actions/download-artifact@v4
with:
name: output
- name: Install Dependencies for Publishing
run: |
npm install -g chrome-webstore-upload-cli
- name: Upload & Publish Extension to Chrome Store
run: |
VERSION=$(cat ./output/version.txt)
chrome-webstore-upload upload \\
--source ./output/ShaderToy-Chrome-Plugin-$VERSION.zip \\
--extension-id $APP_ID \\
--client-id $CLIENT_ID \\
--client-secret $CLIENT_SECRET \\
--refresh-token $REFRESH_TOKEN
release:
runs-on: self-hosted
needs: build
steps:
- name: Download output artifact for release
uses: actions/download-artifact@v4
with:
name: output
- name: Publish Release on GitHub
run: |
VERSION=$(cat ./output/version.txt)
echo "GITHUB_TOKEN"
echo $GITHUB_TOKEN
gh release create $VERSION ./output/ShaderToy-Chrome-Plugin-$VERSION.zip --title "$VERSION" --notes "Release of version $VERSION"