WaniKani Kanji Highlighter v1.5.0 #4
Workflow file for this run
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: Deploy Chrome Extension | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
# Step 1: Pack Extension | |
packExtension: | |
runs-on: ubuntu-latest | |
outputs: | |
zip_path: ${{ steps.pack.outputs.zipFilePath }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build Extension | |
id: pack | |
uses: cardinalby/webext-buildtools-pack-extension-dir-action@v1 | |
with: | |
extensionDir: '.' | |
zipFilePath: 'build/extension.zip' | |
- name: Upload Packed Extension | |
uses: actions/upload-artifact@v4 | |
with: | |
name: extension | |
path: build/extension.zip | |
# Step 2: Fetch Google Access Token | |
fetchToken: | |
runs-on: ubuntu-latest | |
needs: packExtension | |
outputs: | |
access_token_path: google-access-token | |
steps: | |
- id: fetchToken | |
uses: cardinalby/google-api-fetch-token-action@v1 | |
with: | |
clientId: ${{ secrets.G_CLIENT_ID }} | |
clientSecret: ${{ secrets.G_CLIENT_SECRET }} | |
refreshToken: ${{ secrets.G_REFRESH_TOKEN }} | |
- name: Save access token | |
run: | | |
echo "${{ steps.fetchToken.outputs.accessToken }}" > access_token.txt | |
- name: Upload token as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: google-access-token | |
path: access_token.txt | |
# Step 3: Upload Extension | |
uploadExtension: | |
runs-on: ubuntu-latest | |
needs: [packExtension, fetchToken] | |
steps: | |
- name: Download token artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: google-access-token | |
- name: Download extension artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: extension | |
- name: Read access token | |
id: read-token | |
run: echo "ACCESS_TOKEN=$(cat access_token.txt)" >> $GITHUB_ENV | |
- name: Upload to Chrome Web Store | |
uses: cardinalby/webext-buildtools-chrome-webstore-action@v1 | |
with: | |
zipFilePath: 'extension.zip' | |
extensionId: 'pdbjikelneighjgjojikkmhiehpcokjm' | |
apiAccessToken: ${{ env.ACCESS_TOKEN }} | |
# Step 4: Publish Extension | |
publishExtension: | |
runs-on: ubuntu-latest | |
needs: uploadExtension | |
steps: | |
- name: Download token artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: google-access-token | |
- name: Read access token | |
id: read-token | |
run: echo "ACCESS_TOKEN=$(cat access_token.txt)" >> $GITHUB_ENV | |
- name: Publish to Chrome Web Store | |
uses: cardinalby/webext-buildtools-chrome-webstore-publish-action@v1 | |
with: | |
extensionId: 'pdbjikelneighjgjojikkmhiehpcokjm' | |
apiAccessToken: ${{ env.ACCESS_TOKEN }} |