Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieuEv committed Sep 10, 2024
1 parent 3258c6e commit b98a052
Showing 1 changed file with 112 additions and 112 deletions.
224 changes: 112 additions & 112 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,120 +13,120 @@ jobs:
runs-on: ubuntu-latest
environment: env
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Update manifest
run: |
cat manifest.json
# Get the version from the tag and remove the v
VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\/v//')
# Update the manifest and popup with the new version
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" manifest.json
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" manifest-chrome.json
sed -i "s/<p id=\"version\"><\/p>/<p id=\"version\">v$VERSION<\/p>/" popup/index.html
- name: Sign the web-ext
uses: saphareas/sign-web-extension-action@master
with:
web-ext-id: ${{ secrets.UUID }}
sign-listed: true
amo-api-key: ${{ secrets.FIREFOX_JWT_ISSUER }}
amo-api-secret: ${{ secrets.FIREFOX_JWT_SECRET }}
- name: web-ext build
id: web-ext-build
uses: kewisch/action-web-ext@main
with:
cmd: build
source: .

- name: web-ext sign
id: web-ext-sign
uses: kewisch/action-web-ext@main
with:
cmd: sign
source: ${{ steps.web-ext-build.outputs.target }}
channel: unlisted
apiKey: ${{ secrets.FIREFOX_JWT_ISSUER }}
apiSecret: ${{ secrets.FIREFOX_JWT_SECRET }}
timeout: 900000

- name: Mettre à jour le fichier update.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git clone --branch gh-pages https://github.com/matthieuEv/Eseo-tools.git gh-pages
cd gh-pages
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
ls -la
sudo apt-get update
sudo apt-get install -y jq
ls -la
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
ls -la
# Variables
NEW_VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\/v//')
OUTPUT_FILE=$(echo ${{ env.xpi_file }} | sed 's/web-ext-artifacts\///')
UPDATE_LINK="https://matthieuev.github.io/Eseo-tools/$OUTPUT_FILE"
JSON_FILE="updates.json"
ADDON_ID="{3e2f33e0-e00d-48fb-9f13-8b603f960faf}"
# Lire le fichier JSON existant et ajouter la nouvelle version
jq --arg new_version "$NEW_VERSION" --arg update_link "$UPDATE_LINK" --arg addon_id "$ADDON_ID" \
'.addons[$addon_id].updates += [{"version": $new_version, "update_link": $update_link}]' "$JSON_FILE" > tmp.$$.json && mv tmp.$$.json "$JSON_FILE"
echo ">>>"
cat $JSON_FILE
git add $JSON_FILE
git commit -m "Ajout de la version $NEW_VERSION au fichier $JSON_FILE"
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/matthieuEv/Eseo-tools.git gh-pages
- name: Create Zip for Chrome
run: |
rm manifest.json
mv manifest-chrome.json manifest.json
zip -r eseo-tools-for-chrome.zip . -x ".github/*" -x ".git/*"
- name: Create Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
## How to install
- name: Update manifest
run: |
cat manifest.json
For Firefox, Simply download the `.xpi` file under this release, and it will automatically install it on your browser.
# Get the version from the tag and remove the v
VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\/v//')
For Chrome, you must follow these steps:
- Download the `eseo-tools-for-chrome.zip` under this release
- Unzip it where you want to
- Go to chromium/chrome *Extension* settings.
- Click to check *Developer mode*
- Click *Load unpacked extension* and select the folder you unziped
files: |
${{ env.xpi_file }}
eseo-tools-for-chrome.zip
# Update the manifest and popup with the new version
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" manifest.json
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" manifest-chrome.json
sed -i "s/<p id=\"version\"><\/p>/<p id=\"version\">v$VERSION<\/p>/" popup/index.html
- name: Create Github Pages
run: |
mkdir release
- name: Sign the web-ext
uses: saphareas/sign-web-extension-action@master
# 2 copy, one for the latest that overwrite the previous one, and one for the versioned file
cp ${{ env.xpi_file }} release/eseo-tools.xpi
cp ${{ env.xpi_file }} release
# cp gh-pages/updates.json release
echo '<!DOCTYPE html><html><head><title>Eseo Tools</title></head><div id="example-option-1" class="install-ok"><a href="https://matthieuev.github.io/Eseo-tools/eseo-tools.xpi">Install my add-on</a></div></html>' > release/index.html
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
web-ext-id: ${{ secrets.UUID }}
sign-listed: true
amo-api-key: ${{ secrets.FIREFOX_JWT_ISSUER }}
amo-api-secret: ${{ secrets.FIREFOX_JWT_SECRET }}
- name: web-ext build
id: web-ext-build
uses: kewisch/action-web-ext@main
with:
cmd: build
source: .

- name: web-ext sign
id: web-ext-sign
uses: kewisch/action-web-ext@main
with:
cmd: sign
source: ${{ steps.web-ext-build.outputs.target }}
channel: unlisted
apiKey: ${{ secrets.FIREFOX_JWT_ISSUER }}
apiSecret: ${{ secrets.FIREFOX_JWT_SECRET }}
timeout: 900000

- name: Mettre à jour le fichier update.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git clone --branch gh-pages https://github.com/matthieuEv/Eseo-tools.git gh-pages
cd gh-pages
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
ls -la
sudo apt-get update
sudo apt-get install -y jq
ls -la
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
ls -la
# Variables
NEW_VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\/v//')
OUTPUT_FILE=$(echo ${{ env.xpi_file }} | sed 's/web-ext-artifacts\///')
UPDATE_LINK="https://matthieuev.github.io/Eseo-tools/$OUTPUT_FILE"
JSON_FILE="updates.json"
ADDON_ID="{3e2f33e0-e00d-48fb-9f13-8b603f960faf}"
# Lire le fichier JSON existant et ajouter la nouvelle version
jq --arg new_version "$NEW_VERSION" --arg update_link "$UPDATE_LINK" --arg addon_id "$ADDON_ID" \
'.addons[$addon_id].updates += [{"version": $new_version, "update_link": $update_link}]' "$JSON_FILE" > tmp.$$.json && mv tmp.$$.json "$JSON_FILE"
echo ">>>"
cat $JSON_FILE
git add $JSON_FILE
git commit -m "Ajout de la version $NEW_VERSION au fichier $JSON_FILE"
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/matthieuEv/Eseo-tools.git gh-pages
- name: Create Zip for Chrome
run: |
rm manifest.json
mv manifest-chrome.json manifest.json
zip -r eseo-tools-for-chrome.zip . -x ".github/*" -x ".git/*"
- name: Create Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
## How to install
For Firefox, Simply download the `.xpi` file under this release, and it will automatically install it on your browser.
For Chrome, you must follow these steps:
- Download the `eseo-tools-for-chrome.zip` under this release
- Unzip it where you want to
- Go to chromium/chrome *Extension* settings.
- Click to check *Developer mode*
- Click *Load unpacked extension* and select the folder you unziped
files: |
${{ env.xpi_file }}
eseo-tools-for-chrome.zip
- name: Create Github Pages
run: |
mkdir release
# 2 copy, one for the latest that overwrite the previous one, and one for the versioned file
cp ${{ env.xpi_file }} release/eseo-tools.xpi
cp ${{ env.xpi_file }} release
# cp gh-pages/updates.json release
echo '<!DOCTYPE html><html><head><title>Eseo Tools</title></head><div id="example-option-1" class="install-ok"><a href="https://matthieuev.github.io/Eseo-tools/eseo-tools.xpi">Install my add-on</a></div></html>' > release/index.html
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: release
branch: gh-pages
folder: release

0 comments on commit b98a052

Please sign in to comment.