Skip to content

0.2.0

0.2.0 #34

Workflow file for this run

name: "Build"
on:
workflow_dispatch:
release:
types: [published]
env:
SRC_DIR: src
PACKAGE_NAME: aviation_tools
CHROME_ID: cjjhackeogffajjndfhemgniokonimin
MOZILLA_ID: [email protected]
MOZILLA_CHANNEL: unlisted
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
timeout-minutes: 5
#outputs:
# package_name: ${{ steps.manifest.outputs.package_name }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20
- name: "Update Manifest Version"
if: ${{ github.event_name == 'release' }}
uses: cssnr/update-json-value-action@v1
#- name: "Parse Manifest"
# id: manifest
# run: |-
# export name="$(jq '.name' < manifest.json | tr -d '"' | tr '[:upper:]' '[:lower:]')"
# echo "package_name=${name// /_}" >> "$GITHUB_OUTPUT"
- name: "Build All"
run: |-
npm install
npm run build
- name: "Upload to Actions"
uses: actions/upload-artifact@v4
with:
name: artifacts
path: web-ext-artifacts/
- name: "Upload to Release"
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: web-ext-artifacts/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
publish-mozilla:
name: "Publish Mozilla"
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [build]
if: ${{ github.event_name == 'release' }}
steps:
- name: "Download Artifacts"
uses: actions/download-artifact@v4
with:
name: artifacts
- name: "Generate Release Notes"
env:
NOTES: "Full Release Notes: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
uses: jsdaniell/[email protected]
with:
name: "amo-metadata.json"
json: '{"version": {"release_notes": {"en-US": "${{ env.NOTES }}"}}}'
- name: "Sign Mozilla Addon"
run: |-
unzip *firefox* -d src
npx web-ext sign --api-key="${{ secrets.FIREFOX_API_KEY }}" \
--api-secret="${{ secrets.FIREFOX_API_SECRET }}" \
--source-dir="${{ env.SRC_DIR }}" \
--channel="${{ env.MOZILLA_CHANNEL }}" \
--amo-metadata="amo-metadata.json"
- name: "Rename Signed Artifact"
working-directory: web-ext-artifacts
run: |-
ls -l .
mv *.xpi "${{ env.PACKAGE_NAME }}-firefox.xpi"
ls -l .
- name: "Upload to Actions"
uses: actions/upload-artifact@v4
with:
name: signed
path: web-ext-artifacts/
- name: "Upload to Release"
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: web-ext-artifacts/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
update-mozilla:
name: "Update Mozilla"
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [publish-mozilla]
if: ${{ github.event_name == 'release' }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Mozilla Addon Update"
uses: cssnr/mozilla-addon-update-action@v1
with:
url: "https://github.com/cssnr/aviation-tools/releases/download/{version}/aviation_tools-firefox.xpi"
addon_id: ${{ env.MOZILLA_ID }}
version: ${{ github.ref_name }}
- name: "Commit files"
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "Update update.json"
- name: "Push changes"
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
#
# publish-chrome:
# name: 'Publish Chrome'
# runs-on: ubuntu-latest
# timeout-minutes: 30
# needs: [build]
# if: ${{ github.event_name == 'release' }}
#
# steps:
# - name: 'Download Artifacts'
# uses: actions/download-artifact@v3
# with:
# name: artifacts
#
# - name: 'Setup Node'
# uses: actions/setup-node@v3
# with:
# node-version: 18
#
# - name: 'Install chrome-webstore-upload-cli'
# run: |-
# npm install -g chrome-webstore-upload-cli
#
# - name: Upload step
# run: |-
# export archive=$(ls *chrome*.zip)
# chrome-webstore-upload upload \\
# --source chrome-extension-${archive} \\
# --extension-id ${{ env.CHROME_ID }} \\
# --client-id ${{ secrets.CI_GOOGLE_CLIENT_ID }} \\
# --client-secret ${{ secrets.CI_GOOGLE_CLIENT_SECRET }} \\
# --refresh-token ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }}
# - name: 'Rename Signed Artifact'
# working-directory: web-ext-artifacts
# run: |-
# ls -l .
# mv *.xpi "${{ needs.build.outputs.package_name }}-chrome.xpi"
# ls -l .
#
# - name: 'Upload to Actions'
# uses: actions/upload-artifact@v3
# with:
# name: signed
# path: web-ext-artifacts/
#
# - name: 'Upload to Release'
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: web-ext-artifacts/*
# tag: ${{ github.ref }}
# overwrite: true
# file_glob: true