Add a web extension and debian package compilation (#5)
All checks were successful
Check go code / build-and-release (push) Successful in 1m9s
All checks were successful
Check go code / build-and-release (push) Successful in 1m9s
Reviewed-on: #5 Co-authored-by: Julien Fastré <julien.fastre@champs-libres.coop> Co-committed-by: Julien Fastré <julien.fastre@champs-libres.coop>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Release binary for cl-cli
|
||||
name: Release binary and debian package for cl-cli
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,28 +6,79 @@ on:
|
||||
- v**
|
||||
|
||||
jobs:
|
||||
webext-build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:24
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: cd web-extension/cl && npm install
|
||||
- name: Build and sign web extension
|
||||
env:
|
||||
AMO_API_KEY: ${{ secrets.AMO_API_KEY }}
|
||||
AMO_API_SECRET: ${{ secrets.AMO_API_SECRET }}
|
||||
run: cd web-extension/cl && npm run sign
|
||||
- name: Upload web extension artifact
|
||||
uses: https://github.com/actions/upload-artifact@v3
|
||||
with:
|
||||
name: webext-xpi
|
||||
path: web-extension/cl/web-ext-artifacts/*.xpi
|
||||
retention-days: 7
|
||||
if-no-files-found: error
|
||||
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [webext-build]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
- name: Install rust toolchain
|
||||
uses: https://github.com/dtolnay/rust-toolchain@stable
|
||||
- name: Build binaries
|
||||
run: cargo build --release
|
||||
- name: Read release content
|
||||
uses: https://github.com/jaywcjlove/github-action-read-file@main
|
||||
id: read_release
|
||||
- name: Install cargo-deb
|
||||
run: cargo install --quiet cargo-deb
|
||||
- name: Build Debian package
|
||||
run: cargo deb --quiet
|
||||
- name: Upload Debian package to Gitea registry
|
||||
env:
|
||||
GITEA_OWNER: ${{ vars.PUBLISH_USERNAME }}
|
||||
GITEA_SERVER_URL: ${{ github.server_url }}
|
||||
GITEA_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
||||
DEB_DISTRIBUTIONS: noble,plucky,questing
|
||||
DEB_COMPONENT: main
|
||||
DEB_ARCH: amd64
|
||||
run: |
|
||||
set -euo pipefail
|
||||
DEB_FILE=$(ls target/debian/*.deb | head -n1)
|
||||
if [ -z "${DEB_FILE}" ]; then
|
||||
echo "No .deb file found in target/debian" >&2
|
||||
exit 1
|
||||
fi
|
||||
# comma-separated in DEB_DISTRIBUTIONS, e.g. "noble,plucky,questing"
|
||||
IFS=',' read -r -a DISTROS <<< "$DEB_DISTRIBUTIONS"
|
||||
for DISTRO in "${DISTROS[@]}"; do
|
||||
echo "Uploading ${DEB_FILE} to ${GITEA_SERVER_URL} for owner ${GITEA_OWNER}"
|
||||
curl -sSf -X PUT \
|
||||
--user "${GITEA_OWNER}:${GITEA_TOKEN}" \
|
||||
--upload-file "${DEB_FILE}" \
|
||||
"${GITEA_SERVER_URL}/api/packages/${GITEA_OWNER}/debian/pool/${DISTRO}/main/upload"
|
||||
done
|
||||
- name: Download web extension artifact
|
||||
uses: https://github.com/actions/download-artifact@v3
|
||||
with:
|
||||
path: .changes/${{ github.ref_name }}.md
|
||||
name: webext-xpi
|
||||
path: web-extension/cl/web-ext-artifacts
|
||||
- name: Release
|
||||
uses: https://gitea.com/akkuman/gitea-release-action@v1
|
||||
env:
|
||||
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
||||
with:
|
||||
files: |-
|
||||
target/release/cl-cli
|
||||
config.toml.dist
|
||||
web-extension/cl/web-ext-artifacts/*.xpi
|
||||
md5sum: true
|
||||
sha256sum: true
|
||||
body_path: .changes/${{ github.ref_name }}.md
|
||||
body: Test release
|
||||
prerelease: true
|
||||
#body_path: .changes/${{ github.ref_name }}.md
|
||||
|
||||
Reference in New Issue
Block a user