Skip to content

Fixed typo

Fixed typo #51

Workflow file for this run

name: 'CI/CD Pipeline'
on:
push:
branches:
- main
tags:
- v*
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract_info.outputs.version }}
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Extract Information from Manifest"
id: extract_info
run: |
NAME=$(jq -r '.name' src/manifest.json)
VERSION=$(jq -r '.version' src/manifest.json)
echo "NAME=$NAME" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "DO_RELEASE='false'" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: "Create Tag if Version Changed"
id: create_tag
run: |
if git ls-remote --tags origin | grep "refs/tags/v${{ env.VERSION }}" >/dev/null; then
echo "Tag v${{ env.VERSION }} already exists"
else
git config user.name "github-actions"
git config user.email "[email protected]"
git tag v${{ env.VERSION }}
git push origin v${{ env.VERSION }}
echo "::set-output name=create_release::true"
echo "DO_RELEASE='true'" >> $GITHUB_ENV
echo "::set-output name=do_release::true"
fi
- name: Set VERSION
id: set_version
run: echo "::set-output name=VERSION::${GITHUB_REF#refs/tags/v}"
- name: "web-ext build"
id: web-ext-build
uses: kewisch/action-web-ext@v1
with:
cmd: build
source: src
filename: "${{ env.NAME }}-${{ env.VERSION }}.xpi"
env:
WEB_EXT_FILENAME: "${{ env.NAME }}-${{ env.VERSION }}.xpi"
- name: Print DO_RELEASE value
run: echo "The generated file is ${{ env.WEB_EXT_FILENAME }}"
- name: Print filename
run: echo "do release value ${{ env.DO_RELEASE }}"
- name: "Print Ref Information"
run: |
echo "Expected Tag: refs/tags/v${{ env.VERSION }}"
echo "Current Ref: ${{ github.ref }}"
release:
runs-on: ubuntu-latest
needs: build # Ensure the build job completes first
#if: needs.build.outputs.do_release == 'true'
if: github.ref == 'refs/tags/v${{ needs.build.outputs.VERSION }}'
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
#if: startsWith(github.ref, 'refs/tags/v')
steps:
- env:
OUTPUT1: ${{needs.build.outputs.version}}
run: echo "$OUTPUT1"
- name: "Checkout"
uses: actions/checkout@v3
- name: Print VERSION
run: echo "VERSION=${{ needs.build.outputs.VERSION }}"
- name: "web-ext build"
id: web-ext-build
uses: kewisch/action-web-ext@v1
with:
cmd: build
source: src
filename: "trolling-with-love-${{ needs.build.outputs.VERSION }}.xpi"
- 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: listed
apiKey: ${{ secrets.AMO_SIGN_KEY }}
apiSecret: ${{ secrets.AMO_SIGN_SECRET }}
timeout: 900000
- name: "Create GitHub Release"
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ needs.build.outputs.VERSION }}"
release_name: "Release v${{ needs.build.outputs.VERSION }}"
draft: false
prerelease: false
- name: "Upload Release Asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.web-ext-build.outputs.target }}
asset_name: "${{ env.NAME }}-${{ env.VERSION }}.xpi"
asset_content_type: application/x-xpinstall