fix
Cette révision appartient à :
1 Parent
c971022faa
révision
de69a06e72
3 files changed
+263
-214
No files matched your search
@@ -7,6 +7,11 @@ on:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
|
# Prevent two releases from running simultaneously.
|
||||||
|
concurrency:
|
||||||
|
group: firefox-extension-release
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-publish:
|
build-and-publish:
|
||||||
name: Build, package and publish SKYNET SSO
|
name: Build, package and publish SKYNET SSO
|
||||||
@@ -16,10 +21,14 @@ jobs:
|
|||||||
EXTENSION_DIR: src/
|
EXTENSION_DIR: src/
|
||||||
REPOSITORY: ${{ gitea.repository }}
|
REPOSITORY: ${{ gitea.repository }}
|
||||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }}
|
||||||
|
AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 1. Checkout du dépôt
|
# 1. Checkout
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
|
|
||||||
- name: Checkout main branch
|
- name: Checkout main branch
|
||||||
@@ -30,14 +39,12 @@ jobs:
|
|||||||
token: ${{ secrets.GITEA_TOKEN }}
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 2. Détermination de la prochaine version
|
# 2. Calculate next version
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
|
|
||||||
- name: Determine next version
|
- name: Determine next version
|
||||||
id: version
|
id: version
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -58,9 +65,9 @@ jobs:
|
|||||||
|
|
||||||
VERSION="${CURRENT_VERSION}"
|
VERSION="${CURRENT_VERSION}"
|
||||||
|
|
||||||
echo "Version found in manifest: ${VERSION}"
|
echo "Manifest version: ${CURRENT_VERSION}"
|
||||||
|
|
||||||
# Increment patch version while the corresponding tag exists.
|
# Increment patch version until an unused tag is found.
|
||||||
while git show-ref --verify --quiet "refs/tags/v${VERSION}"; do
|
while git show-ref --verify --quiet "refs/tags/v${VERSION}"; do
|
||||||
echo "Tag v${VERSION} already exists."
|
echo "Tag v${VERSION} already exists."
|
||||||
|
|
||||||
@@ -72,17 +79,19 @@ jobs:
|
|||||||
|
|
||||||
RELEASE_TAG="v${VERSION}"
|
RELEASE_TAG="v${VERSION}"
|
||||||
|
|
||||||
echo "Selected version: ${VERSION}"
|
echo "Next version: ${VERSION}"
|
||||||
echo "Selected tag: ${RELEASE_TAG}"
|
echo "Release tag: ${RELEASE_TAG}"
|
||||||
|
|
||||||
# Update manifest version.
|
# Update manifest in the runner workspace only.
|
||||||
node - "${EXTENSION_DIR}/manifest.json" "${VERSION}" <<'NODE'
|
node - "${EXTENSION_DIR}/manifest.json" "${VERSION}" <<'NODE'
|
||||||
const fs = require("node:fs");
|
const fs = require("node:fs");
|
||||||
|
|
||||||
const file = process.argv[2];
|
const file = process.argv[2];
|
||||||
const version = process.argv[3];
|
const version = process.argv[3];
|
||||||
|
|
||||||
const manifest = JSON.parse(fs.readFileSync(file, "utf8"));
|
const manifest = JSON.parse(
|
||||||
|
fs.readFileSync(file, "utf8")
|
||||||
|
);
|
||||||
|
|
||||||
manifest.version = version;
|
manifest.version = version;
|
||||||
|
|
||||||
@@ -94,45 +103,255 @@ jobs:
|
|||||||
console.log(`Manifest updated to ${version}`);
|
console.log(`Manifest updated to ${version}`);
|
||||||
NODE
|
NODE
|
||||||
|
|
||||||
# Configure Git identity.
|
# Export values to subsequent steps.
|
||||||
|
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
|
||||||
|
echo "RELEASE_TAG=${RELEASE_TAG}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# 3. Install build tools
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
|
- name: Install build tools
|
||||||
|
run: |
|
||||||
|
npm install --no-save --no-audit --no-fund \
|
||||||
|
terser@5.44.1 \
|
||||||
|
clean-css-cli@5.6.3 \
|
||||||
|
html-minifier-terser@7.2.0 \
|
||||||
|
web-ext@8.9.0
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# 4. Prepare and minify extension
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
|
- name: Prepare and safely minify extension
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
rm -rf dist artifacts
|
||||||
|
mkdir -p dist artifacts
|
||||||
|
|
||||||
|
cp -a "${EXTENSION_DIR}/." dist/
|
||||||
|
rm -f dist/README.md
|
||||||
|
|
||||||
|
# Minify JavaScript.
|
||||||
|
while IFS= read -r -d '' file; do
|
||||||
|
tmp="${file}.min"
|
||||||
|
|
||||||
|
npx --no-install terser "${file}" \
|
||||||
|
--compress --mangle \
|
||||||
|
--output "${tmp}"
|
||||||
|
|
||||||
|
mv "${tmp}" "${file}"
|
||||||
|
done < <(find dist -type f -name '*.js' -print0)
|
||||||
|
|
||||||
|
# Minify CSS.
|
||||||
|
while IFS= read -r -d '' file; do
|
||||||
|
tmp="${file}.min"
|
||||||
|
|
||||||
|
npx --no-install cleancss \
|
||||||
|
--compatibility ie11 -O2 \
|
||||||
|
--output "${tmp}" "${file}"
|
||||||
|
|
||||||
|
mv "${tmp}" "${file}"
|
||||||
|
done < <(find dist -type f -name '*.css' -print0)
|
||||||
|
|
||||||
|
# Minify HTML.
|
||||||
|
while IFS= read -r -d '' file; do
|
||||||
|
tmp="${file}.min"
|
||||||
|
|
||||||
|
npx --no-install html-minifier-terser \
|
||||||
|
--collapse-whitespace \
|
||||||
|
--remove-comments \
|
||||||
|
--minify-css \
|
||||||
|
--keep-closing-slash \
|
||||||
|
"${file}" --output "${tmp}"
|
||||||
|
|
||||||
|
mv "${tmp}" "${file}"
|
||||||
|
done < <(find dist -type f -name '*.html' -print0)
|
||||||
|
|
||||||
|
# Validate manifest and referenced resources.
|
||||||
|
node <<'NODE'
|
||||||
|
const fs = require("node:fs");
|
||||||
|
const path = require("node:path");
|
||||||
|
|
||||||
|
const root = path.resolve("dist");
|
||||||
|
|
||||||
|
const manifest = JSON.parse(
|
||||||
|
fs.readFileSync(
|
||||||
|
path.join(root, "manifest.json"),
|
||||||
|
"utf8"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const required = [
|
||||||
|
...(manifest.background?.scripts || []),
|
||||||
|
|
||||||
|
...(manifest.content_scripts || []).flatMap(s => [
|
||||||
|
...(s.js || []),
|
||||||
|
...(s.css || [])
|
||||||
|
]),
|
||||||
|
|
||||||
|
...(manifest.options_ui?.page
|
||||||
|
? [manifest.options_ui.page]
|
||||||
|
: []),
|
||||||
|
|
||||||
|
...(manifest.action?.default_popup
|
||||||
|
? [manifest.action.default_popup]
|
||||||
|
: []),
|
||||||
|
|
||||||
|
...Object.values(manifest.icons || {}),
|
||||||
|
|
||||||
|
...(manifest.web_accessible_resources || []).flatMap(
|
||||||
|
r => r.resources || []
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const entry of required) {
|
||||||
|
const target = path.resolve(root, entry);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!target.startsWith(root + path.sep) ||
|
||||||
|
!fs.existsSync(target)
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`Manifest resource missing or invalid: ${entry}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`Manifest OK; ${required.length} resources verified.`
|
||||||
|
);
|
||||||
|
NODE
|
||||||
|
|
||||||
|
# Firefox extension validation.
|
||||||
|
npx --no-install web-ext lint --source-dir dist
|
||||||
|
|
||||||
|
# Generate ZIP.
|
||||||
|
ZIP_NAME="SKYNET-SSO-${RELEASE_TAG}.zip"
|
||||||
|
|
||||||
|
(
|
||||||
|
cd dist
|
||||||
|
zip -qr "../artifacts/${ZIP_NAME}" .
|
||||||
|
)
|
||||||
|
|
||||||
|
test -s "artifacts/${ZIP_NAME}"
|
||||||
|
|
||||||
|
echo "ZIP_NAME=${ZIP_NAME}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
echo "Build completed successfully."
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# 5. Sign extension with Mozilla AMO
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
|
- name: Sign extension with Mozilla AMO
|
||||||
|
id: amo
|
||||||
|
if: ${{ env.AMO_JWT_ISSUER != '' && env.AMO_JWT_SECRET != '' }}
|
||||||
|
continue-on-error: true
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
mkdir -p artifacts/amo
|
||||||
|
|
||||||
|
echo "Starting Mozilla AMO signing."
|
||||||
|
|
||||||
|
npx --no-install web-ext sign \
|
||||||
|
--source-dir dist \
|
||||||
|
--artifacts-dir artifacts/amo \
|
||||||
|
--channel unlisted \
|
||||||
|
--api-key "${AMO_JWT_ISSUER}" \
|
||||||
|
--api-secret "${AMO_JWT_SECRET}" \
|
||||||
|
--no-input
|
||||||
|
|
||||||
|
XPI="$(find artifacts/amo \
|
||||||
|
-maxdepth 1 -type f -name '*.xpi' -print -quit)"
|
||||||
|
|
||||||
|
if [[ -z "${XPI}" ]]; then
|
||||||
|
echo "::error::AMO did not return a signed XPI."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp "${XPI}" "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi"
|
||||||
|
|
||||||
|
echo "AMO signing completed successfully."
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# 6. Verify build artifacts before publication
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
|
- name: Verify release files
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ZIP="artifacts/SKYNET-SSO-${RELEASE_TAG}.zip"
|
||||||
|
|
||||||
|
if [[ ! -s "${ZIP}" ]]; then
|
||||||
|
echo "::error::ZIP archive is missing."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi" ]]; then
|
||||||
|
echo "Signed XPI available."
|
||||||
|
else
|
||||||
|
echo "No signed XPI available. ZIP will be published."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "All required build files are ready."
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# 7. Commit manifest and push Git tag
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
|
- name: Commit manifest and create Git tag
|
||||||
|
id: git_publish
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
git config user.name "Gitea Actions"
|
git config user.name "Gitea Actions"
|
||||||
git config user.email "actions@celjim.fr"
|
git config user.email "actions@celjim.fr"
|
||||||
|
|
||||||
# Commit the manifest only if it has changed.
|
# Check that the remote tag is still available.
|
||||||
|
git fetch --force --tags origin
|
||||||
|
|
||||||
|
if git show-ref --verify --quiet "refs/tags/${RELEASE_TAG}"; then
|
||||||
|
echo "::error::Tag ${RELEASE_TAG} already exists."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Commit manifest version.
|
||||||
if ! git diff --quiet -- "${EXTENSION_DIR}/manifest.json"; then
|
if ! git diff --quiet -- "${EXTENSION_DIR}/manifest.json"; then
|
||||||
git add "${EXTENSION_DIR}/manifest.json"
|
git add "${EXTENSION_DIR}/manifest.json"
|
||||||
git commit -m "chore(release): ${RELEASE_TAG}"
|
git commit -m "chore(release): ${RELEASE_TAG}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Push updated manifest to main.
|
||||||
AUTH="$(printf 'x-access-token:%s' "${GITEA_TOKEN}" | base64 -w 0)"
|
AUTH="$(printf 'x-access-token:%s' "${GITEA_TOKEN}" | base64 -w 0)"
|
||||||
|
|
||||||
git -c http.extraheader="AUTHORIZATION: basic ${AUTH}" \
|
git -c http.extraheader="AUTHORIZATION: basic ${AUTH}" \
|
||||||
push origin HEAD:main
|
push origin HEAD:refs/heads/main
|
||||||
else
|
|
||||||
echo "Manifest version is unchanged."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create and push the annotated tag.
|
# Create annotated tag.
|
||||||
git tag -a "${RELEASE_TAG}" HEAD \
|
git tag -a "${RELEASE_TAG}" HEAD \
|
||||||
-m "Release ${RELEASE_TAG}"
|
-m "Release ${RELEASE_TAG}"
|
||||||
|
|
||||||
AUTH="$(printf 'x-access-token:%s' "${GITEA_TOKEN}" | base64 -w 0)"
|
# Push tag.
|
||||||
|
|
||||||
git -c http.extraheader="AUTHORIZATION: basic ${AUTH}" \
|
git -c http.extraheader="AUTHORIZATION: basic ${AUTH}" \
|
||||||
push origin "refs/tags/${RELEASE_TAG}"
|
push origin "refs/tags/${RELEASE_TAG}"
|
||||||
|
|
||||||
echo "VERSION=${VERSION}" >> "${GITEA_ENV:-$GITHUB_ENV}"
|
echo "Git commit and tag published successfully."
|
||||||
echo "RELEASE_TAG=${RELEASE_TAG}" >> "${GITEA_ENV:-$GITHUB_ENV}"
|
|
||||||
echo "GITEA_SHA=$(git rev-parse HEAD)" >> "${GITEA_ENV:-$GITHUB_ENV}"
|
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 3. Création de la release Gitea
|
# 8. Create Gitea release
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
|
|
||||||
- name: Create Gitea release
|
- name: Create Gitea release
|
||||||
id: release
|
id: release
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -140,8 +359,6 @@ jobs:
|
|||||||
OWNER="${REPOSITORY%%/*}"
|
OWNER="${REPOSITORY%%/*}"
|
||||||
REPO="${REPOSITORY#*/}"
|
REPO="${REPOSITORY#*/}"
|
||||||
|
|
||||||
echo "Creating release ${RELEASE_TAG}..."
|
|
||||||
|
|
||||||
jq -n \
|
jq -n \
|
||||||
--arg tag "${RELEASE_TAG}" \
|
--arg tag "${RELEASE_TAG}" \
|
||||||
--arg version "${VERSION}" \
|
--arg version "${VERSION}" \
|
||||||
@@ -149,7 +366,11 @@ jobs:
|
|||||||
tag_name: $tag,
|
tag_name: $tag,
|
||||||
target_commitish: "main",
|
target_commitish: "main",
|
||||||
name: ("SKYNET SSO " + $tag),
|
name: ("SKYNET SSO " + $tag),
|
||||||
body: ("Release automatique de SKYNET SSO version " + $version + "."),
|
body: (
|
||||||
|
"Release automatique de SKYNET SSO version "
|
||||||
|
+ $version
|
||||||
|
+ "."
|
||||||
|
),
|
||||||
draft: false,
|
draft: false,
|
||||||
prerelease: false
|
prerelease: false
|
||||||
}' > release-payload.json
|
}' > release-payload.json
|
||||||
@@ -165,189 +386,21 @@ jobs:
|
|||||||
RELEASE_ID="$(jq -r '.id // empty' release-response.json)"
|
RELEASE_ID="$(jq -r '.id // empty' release-response.json)"
|
||||||
|
|
||||||
if [[ -z "${RELEASE_ID}" ]]; then
|
if [[ -z "${RELEASE_ID}" ]]; then
|
||||||
echo "::error::Unable to retrieve the Gitea release ID."
|
echo "::error::Unable to retrieve Gitea release ID."
|
||||||
cat release-response.json
|
cat release-response.json
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Release created: ${RELEASE_TAG} (ID: ${RELEASE_ID})"
|
echo "RELEASE_ID=${RELEASE_ID}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
echo "RELEASE_ID=${RELEASE_ID}" >> "${GITEA_ENV:-$GITHUB_ENV}"
|
echo "Gitea release created: ${RELEASE_TAG}"
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 4. Checkout du commit associé au tag
|
# 9. Upload release files to Gitea
|
||||||
# --------------------------------------------------
|
|
||||||
|
|
||||||
- name: Checkout release commit
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
git checkout --detach "refs/tags/${RELEASE_TAG}"
|
|
||||||
|
|
||||||
echo "Building ${RELEASE_TAG}"
|
|
||||||
echo "Commit: $(git rev-parse HEAD)"
|
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# 5. Installation des outils de compilation
|
|
||||||
# --------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install build tools
|
|
||||||
run: |
|
|
||||||
npm install --no-save --no-audit --no-fund \
|
|
||||||
terser@5.44.1 \
|
|
||||||
clean-css-cli@5.6.3 \
|
|
||||||
html-minifier-terser@7.2.0 \
|
|
||||||
web-ext@8.9.0
|
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# 6. Préparation et minification
|
|
||||||
# --------------------------------------------------
|
|
||||||
|
|
||||||
- name: Prepare and safely minify extension
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
rm -rf dist artifacts
|
|
||||||
mkdir -p dist artifacts
|
|
||||||
|
|
||||||
cp -a "${EXTENSION_DIR}/." dist/
|
|
||||||
rm -f dist/README.md
|
|
||||||
|
|
||||||
# JavaScript
|
|
||||||
while IFS= read -r -d '' file; do
|
|
||||||
tmp="${file}.min"
|
|
||||||
|
|
||||||
npx --no-install terser "${file}" \
|
|
||||||
--compress --mangle \
|
|
||||||
--output "${tmp}"
|
|
||||||
|
|
||||||
mv "${tmp}" "${file}"
|
|
||||||
done < <(find dist -type f -name '*.js' -print0)
|
|
||||||
|
|
||||||
# CSS
|
|
||||||
while IFS= read -r -d '' file; do
|
|
||||||
tmp="${file}.min"
|
|
||||||
|
|
||||||
npx --no-install cleancss \
|
|
||||||
--compatibility ie11 -O2 \
|
|
||||||
--output "${tmp}" "${file}"
|
|
||||||
|
|
||||||
mv "${tmp}" "${file}"
|
|
||||||
done < <(find dist -type f -name '*.css' -print0)
|
|
||||||
|
|
||||||
# HTML
|
|
||||||
while IFS= read -r -d '' file; do
|
|
||||||
tmp="${file}.min"
|
|
||||||
|
|
||||||
npx --no-install html-minifier-terser \
|
|
||||||
--collapse-whitespace \
|
|
||||||
--remove-comments \
|
|
||||||
--minify-css \
|
|
||||||
--keep-closing-slash \
|
|
||||||
"${file}" --output "${tmp}"
|
|
||||||
|
|
||||||
mv "${tmp}" "${file}"
|
|
||||||
done < <(find dist -type f -name '*.html' -print0)
|
|
||||||
|
|
||||||
# Validate manifest and referenced files.
|
|
||||||
node <<'NODE'
|
|
||||||
const fs = require("node:fs");
|
|
||||||
const path = require("node:path");
|
|
||||||
|
|
||||||
const root = path.resolve("dist");
|
|
||||||
const manifest = JSON.parse(
|
|
||||||
fs.readFileSync(path.join(root, "manifest.json"), "utf8")
|
|
||||||
);
|
|
||||||
|
|
||||||
const required = [
|
|
||||||
...(manifest.background?.scripts || []),
|
|
||||||
...(manifest.content_scripts || []).flatMap(s => [
|
|
||||||
...(s.js || []),
|
|
||||||
...(s.css || [])
|
|
||||||
]),
|
|
||||||
...(manifest.options_ui?.page ? [manifest.options_ui.page] : []),
|
|
||||||
...(manifest.action?.default_popup ? [manifest.action.default_popup] : []),
|
|
||||||
...Object.values(manifest.icons || {}),
|
|
||||||
...(manifest.web_accessible_resources || []).flatMap(
|
|
||||||
r => r.resources || []
|
|
||||||
)
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const entry of required) {
|
|
||||||
const target = path.resolve(root, entry);
|
|
||||||
|
|
||||||
if (
|
|
||||||
!target.startsWith(root + path.sep) ||
|
|
||||||
!fs.existsSync(target)
|
|
||||||
) {
|
|
||||||
throw new Error(`Manifest resource missing or invalid: ${entry}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
`Manifest OK; ${required.length} referenced resources verified.`
|
|
||||||
);
|
|
||||||
NODE
|
|
||||||
|
|
||||||
# Firefox extension validation.
|
|
||||||
npx --no-install web-ext lint --source-dir dist
|
|
||||||
|
|
||||||
# ZIP archive.
|
|
||||||
ZIP_NAME="SKYNET-SSO-${RELEASE_TAG}.zip"
|
|
||||||
|
|
||||||
(
|
|
||||||
cd dist
|
|
||||||
zip -qr "../artifacts/${ZIP_NAME}" .
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "ZIP_NAME=${ZIP_NAME}" >> "${GITEA_ENV:-$GITHUB_ENV}"
|
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# 7. Signature et soumission AMO
|
|
||||||
# --------------------------------------------------
|
|
||||||
|
|
||||||
- name: Sign and submit to Firefox Add-ons (AMO)
|
|
||||||
id: amo
|
|
||||||
if: ${{ secrets.AMO_JWT_ISSUER != '' && secrets.AMO_JWT_SECRET != '' }}
|
|
||||||
env:
|
|
||||||
AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }}
|
|
||||||
AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
mkdir -p artifacts/amo
|
|
||||||
|
|
||||||
echo "AMO credentials available."
|
|
||||||
|
|
||||||
npx --no-install web-ext sign \
|
|
||||||
--source-dir dist \
|
|
||||||
--artifacts-dir artifacts/amo \
|
|
||||||
--channel unlisted \
|
|
||||||
--api-key "${AMO_JWT_ISSUER}" \
|
|
||||||
--api-secret "${AMO_JWT_SECRET}" \
|
|
||||||
--no-input
|
|
||||||
|
|
||||||
XPI="$(find artifacts/amo -maxdepth 1 -type f -name '*.xpi' -print -quit)"
|
|
||||||
|
|
||||||
if [[ -z "${XPI}" ]]; then
|
|
||||||
echo "::error::AMO did not return a signed XPI."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp "${XPI}" "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi"
|
|
||||||
|
|
||||||
echo "AMO signing completed."
|
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# 8. Envoi des fichiers vers la release Gitea
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
|
|
||||||
- name: Upload release files to Gitea
|
- name: Upload release files to Gitea
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -355,8 +408,6 @@ jobs:
|
|||||||
OWNER="${REPOSITORY%%/*}"
|
OWNER="${REPOSITORY%%/*}"
|
||||||
REPO="${REPOSITORY#*/}"
|
REPO="${REPOSITORY#*/}"
|
||||||
|
|
||||||
AUTH_HEADER="Authorization: token ${GITEA_TOKEN}"
|
|
||||||
|
|
||||||
upload_asset() {
|
upload_asset() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
local name
|
local name
|
||||||
@@ -367,23 +418,26 @@ jobs:
|
|||||||
|
|
||||||
curl --fail --silent --show-error \
|
curl --fail --silent --show-error \
|
||||||
--request POST \
|
--request POST \
|
||||||
--header "${AUTH_HEADER}" \
|
--header "Authorization: token ${GITEA_TOKEN}" \
|
||||||
--form "attachment=@${file}" \
|
--form "attachment=@${file}" \
|
||||||
"${API_BASE}/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}/assets?name=${name}"
|
"${API_BASE}/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}/assets?name=${name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ZIP is always uploaded.
|
# Always upload ZIP.
|
||||||
upload_asset "artifacts/SKYNET-SSO-${RELEASE_TAG}.zip"
|
upload_asset "artifacts/SKYNET-SSO-${RELEASE_TAG}.zip"
|
||||||
|
|
||||||
# XPI is uploaded only if AMO signing succeeded.
|
# Upload XPI only if AMO signing succeeded.
|
||||||
if [[ -f "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi" ]]; then
|
if [[ -f "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi" ]]; then
|
||||||
upload_asset "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi"
|
upload_asset "artifacts/SKYNET-SSO-${RELEASE_TAG}.xpi"
|
||||||
else
|
else
|
||||||
echo "AMO credentials unavailable; XPI publication skipped."
|
echo "AMO signing unavailable or unsuccessful."
|
||||||
|
echo "Publishing ZIP only."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Release assets uploaded successfully."
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# 9. Conservation des artefacts du workflow
|
# 10. Preserve workflow artifacts
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
|
|
||||||
- name: Preserve build files in workflow artifacts
|
- name: Preserve build files in workflow artifacts
|
||||||
|
|||||||
Fichier binaire non affiché.
|
Avant Largeur: | Hauteur: | Taille: 58 KiB Après Largeur: | Hauteur: | Taille: 67 KiB |
@@ -6,12 +6,7 @@
|
|||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
"id": "skynet-sso@celjim.fr",
|
"id": "skynet-sso@celjim.fr",
|
||||||
"strict_min_version": "128.0",
|
"strict_min_version": "128.0"
|
||||||
"data_collection_permissions": {
|
|
||||||
"required": [
|
|
||||||
"none"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"permissions": ["storage", "tabs"],
|
"permissions": ["storage", "tabs"],
|
||||||
@@ -22,7 +17,7 @@
|
|||||||
"matches": ["http://*/*", "https://*/*"]
|
"matches": ["http://*/*", "https://*/*"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icons": { "128": "icons/logoSkynet.ico" },
|
"icons": { "128": "icons/logoSkynet.png" },
|
||||||
"background": { "scripts": ["background.js"] },
|
"background": { "scripts": ["background.js"] },
|
||||||
"content_scripts": [{
|
"content_scripts": [{
|
||||||
"matches": ["http://*/*", "https://*/*"],
|
"matches": ["http://*/*", "https://*/*"],
|
||||||
|
|||||||
Référencer dans un nouveau ticket
Bloquer un utilisateur