Skip to content

use github pages to release firefox #43

use github pages to release firefox

use github pages to release firefox #43

name: Firefox & Chrome Web Extension Release
on:
push:
branches:
- master
jobs:
release:
name: "Create a release"
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: "Get Version"
run: echo "VERSION=$(jq -r '.version' manifest.json)" >> $GITHUB_ENV
- name: "Echo Version"
run: echo $VERSION
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: skribbltypo-release-${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: Stable release of skribbl typo, version ${{ env.VERSION }}
draft: false
prerelease: false
publish-chrome:
needs: release
name: "Release Chrome Web Ext"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "Get Version"
run: echo "VERSION=$(jq -r '.version' manifest.json)" >> $GITHUB_ENV
- name: "Echo Version"
run: echo $VERSION
- name: Archive Release
uses: thedoctor0/zip-release@master
with:
filename: typo-chromium-release-${{ env.VERSION }}.zip
exclusions: "*.git* *.xpi skribbltypo.user.js userscript-gen.js readme.md patch.json /*extensions/* *.web-extension-id .editorconfig .github/"
- name: Append to artifacts
uses: actions/upload-artifact@v3
with:
name: typo-chromium-release-${{ env.VERSION }}
path: typo-chromium-release-${{ env.VERSION }}.zip
- name: Append to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: typo-chromium-release-${{ env.VERSION }}.zip
asset_name: typo-chromium-release-${{ env.VERSION }}.zip
asset_content_type: application/zip
publish-firefox:
needs: release
name: "Release Firefox Web Ext"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "Get Version"
run: echo "VERSION=$(jq -r '.version' manifest.json)" >> $GITHUB_ENV
- name: "Echo Version"
run: echo $VERSION
- name: "web-ext build"
id: web-ext-build
uses: kewisch/action-web-ext@v1
with:
cmd: build
source: ./
exclusions: '["skribbltypo.user.js", "userscript-gen.js"," patch.json", "/*extensions/*"]'
- name: "web-ext sign"
id: web-ext-sign
uses: kewisch/action-web-ext@v1
with:
cmd: sign
source: ${{ steps.web-ext-build.outputs.target }}
channel: unlisted
apiKey: ${{ secrets.MOZILLA_API_KEY }}
apiSecret: ${{ secrets.MOZILLA_API_SECRET }}
timeout: 900000
- name: Archive signed XPI
uses: actions/upload-artifact@v3
with:
name: typo-firefox-signed-release-${{env.VERSION}}
path: ${{ steps.web-ext-sign.outputs.target }}
- name: "Publish update to tobeh.host"
env:
FILE_PATH: ${{ steps.web-ext-sign.outputs.target }}
VERSION: ${{env.VERSION}}
AUTH: ${{ secrets.FF_UPDATE_AUTH }}
SCRIPT_URL: ${{ secrets.FF_UPDATE_URL }}
run: |
curl -X POST -F "file=@$FILE_PATH" -F "version=$VERSION" -F "auth=$AUTH" $SCRIPT_URL
- name: Append to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ steps.web-ext-sign.outputs.target }}
asset_name: typo-firefox-signed-release-${{env.VERSION}}.xpi
asset_content_type: application/x-xpinstall
publish-firefox-github-pages:
needs: publish-firefox
name: "Publish firefox to GitHub Pages"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: "Create dist directory"
run: mkdir -p dist
- name: "Copy XPI to dist"
run: cp ${{ steps.web-ext-sign.outputs.target }} ./dist/typo-firefox-signed-release-${{ env.VERSION }}.xpi
- name: "Create updates.json"
run: |
echo '{
"addons": {
"{0b67dc2f-1517-451c-b5cb-8b28270b03e6}": {
"updates": [
{
"version": "'${{ env.VERSION }}'",
"update_link": "https://toobeeh.github.io/skribbltypo/typo-firefox-release-${{ env.VERSION }}.xpi"
}
]
}
}
}' > ./dist/updates.json
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v1
with:
path: ./dist # Path to your static site files