Skip to content

Commit

Permalink
Move flatpak manifests into their own directory - update script.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
oskirby committed Aug 22, 2024
1 parent cf472c2 commit f69d349
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 57 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
uses: actions/checkout@v4
with:
path: src
sparse-checkout: |
linux/flatpak
Cargo.lock
- name: Checkout tools
uses: actions/checkout@v4
Expand All @@ -38,18 +41,18 @@ jobs:
shell: bash
run: pip install requirements-parser PyYAML toml yq

- name: Generate Cargo deps
- name: Update Cargo dependencies
shell: bash
working-directory: src
run: |
../tools/cargo/flatpak-cargo-generator.py -o flatpak-sources-cargo.json Cargo.lock
cat flatpak-sources-cargo.json | yq -y > linux/flatpak-vpn-crates.yaml
cat flatpak-sources-cargo.json | yq -y > linux/flatpak/flatpak-vpn-crates.yaml
- name: Update git reference
shell: bash
working-directory: src/linux
working-directory: src/linux/flatpak
run: |
yq -yi '.modules[-1].sources[0] = {"type": "git"}' org.mozilla.vpn.yml
yq -yi 'del(.modules[-1].sources[0].branch)' org.mozilla.vpn.yml
yq -yi ".modules[-1].sources[0].url = \"https://github.com/${{ github.repository }}\"" org.mozilla.vpn.yml
yq -yi ".modules[-1].sources[0].commit = \"${{ github.sha }}\"" org.mozilla.vpn.yml
cat org.mozilla.vpn.yml
Expand All @@ -58,5 +61,5 @@ jobs:
uses: flathub-infra/flatpak-github-actions/flatpak-builder@master
with:
bundle: mozillavpn.flatpak
manifest-path: src/linux/org.mozilla.vpn.yml
manifest-path: src/linux/flatpak/org.mozilla.vpn.yml
cache-key: flatpak-builder-${{ github.sha }}
41 changes: 0 additions & 41 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,47 +45,6 @@ jobs:
name: Sources
path: .tmp

flatpak:
name: Flatpak Packages
needs: source-bundle
runs-on: ubuntu-latest

steps:
- name: Download Source Package
uses: actions/download-artifact@v4
with:
name: Sources

- name: Install Flatpak Tools
shell: bash
run: |
sudo apt-get update
sudo apt-get install flatpak flatpak-builder -y
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Installing Dependencies
shell: bash
run: |
mkdir fp-build-dir
flatpak-builder --user --install-deps-from=flathub --install-deps-only fp-build-dir org.mozilla.vpn.yml
- name: Building Flatpak
shell: bash
run: flatpak-builder --user fp-build-dir org.mozilla.vpn.yml

- name: Exporting Flatpak
shell: bash
run: |
mkdir fp-export-dir
flatpak build-export fp-export-dir fp-build-dir
flatpak build-bundle fp-export-dir mozillavpn.flatpak org.mozilla.vpn
- name: Uploading
uses: actions/upload-artifact@v4
with:
name: Flatpak Build
path: mozillavpn.flatpak

rpmbuild:
name: RPM Packages
needs: source-bundle
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ modules:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DBUILD_FLATPAK=ON
sources:
- type: dir
path: ..
- type: git
url: https://github.com/mozilla-mobile/mozilla-vpn-client
branch: main

# Install vendored Rust crates
- flatpak-vpn-crates.yaml
Expand Down
20 changes: 11 additions & 9 deletions scripts/linux/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ fi

printn Y "Computing the version... "
SHORTVERSION=$(cat version.txt)
GITHASH=$(git rev-parse HEAD)

# Adjust the package version if a gitref was provided:
# - Pull requests are suffixed with "~pr<Pull Request Number>"
Expand Down Expand Up @@ -177,15 +178,16 @@ EOF

## Update the flatpak manifest to use the source tarball.
build_flatpak_manifest() {
# Copy recipies for dependent modules.
cp $WORKDIR/linux/flatpak-* .

# Truncate the YAML at the sources, and replace it with the tarball archive
sed -e '1,/[[:space:]]\+sources:/!d' $WORKDIR/linux/org.mozilla.vpn.yml > org.mozilla.vpn.yml
cat << EOF >> org.mozilla.vpn.yml
- type: archive
path: mozillavpn_$SHORTVERSION.orig.tar.gz
EOF
# Copy recipies for dependent modules.
rm -rf $WORKDIR/flatpak || die "Failed"
cp -r ../linux/flatpak $WORKDIR || die "Failed"

# Update the git reference.
if [[ "$GITREF" =~ ^refs/tags/(v[0-9a-z.]+) ]]; then
sed -ie "s/branh: main/tag: ${BASH_REMATCH[1]}/" $WORKDIR/flatpak/org.mozilla.vpn.yml
else
sed -ie "s/branch: main/commit: $(git -C .. rev-parse HEAD)/" $WORKDIR/flatpak/org.mozilla.vpn.yml
fi
}

## Build the DSC and debian tarball.
Expand Down

0 comments on commit f69d349

Please sign in to comment.